严格模式下 new logThis() 会在 console 输出什么?
What is the result in the console of running this code with 'use strict' and new logThis()?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: medium
分类: JavaScript OOP
标签: this, strict mode, constructor
参考答案摘要
使用 new 调用函数会创建一个新对象并绑定给 this ,所以打印的是新实例对象: {desc: "logger"} 。
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。