Open xinbaihui opened 5 years ago
function Person(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } const member = new Person("Lydia", "Hallie"); Person.getFullName = function() { return `${this.firstName} ${this.lastName}`; }; console.log(member.getFullName());
A: TypeError B: SyntaxError C: Lydia Hallie D: undefined undefined
解析: new Person()做了什么
const obj = {} Person.call(obj, para) obj.__proto__ = Person.prototype return obj
思考:
参考:https://github.com/lydiahallie/javascript-questions, 11
A: TypeError B: SyntaxError C: Lydia Hallie D: undefined undefined
Answer
A解析: new Person()做了什么
思考:
参考:https://github.com/lydiahallie/javascript-questions, 11