logo

const dessert = {type:'pie'}; dessert.type='pudding'; 后 dessert.type 的值是什么?

What is the value of dessert.type after executing this code?

题目类型: 技术面试题

这是一道技术面试题,常见于澳洲IT公司面试中。

难度: easy

分类: JavaScript Objects

标签: const, mutation, object properties

参考答案摘要

const 只保证变量绑定不可重新赋值,但对象内容仍可修改,因此结果为 pudding 。

本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。

← 返回面试题库

const dessert = {type:'pie'}; dessert.type='pudding'; 后 dessert.type 的值是什么?

Easyjavascript

想查看完整答案?

登录匠人学院学习中心,获取 STAR 格式回答和详细技术解析

前往学习中心查看答案