前端基础 | 理解原型-作用域-执行上下文

基础代码: // 使用构造函数创建一个对象 function Person() {} Person.prototype.name = 'Brand' let person = new Person() console.log(person.name) // Brand 复制代码 prototype 每个函数都有一个 prototype 属性。 prototype 是函数才会有的属性。 函数的 prototype 属性是指 通过调用构造函数而...