摘要:
new 一句话介绍 new: new 运算符创建一个用户定义的对象类型的实例或具有构造函数的内置对象类型之一 也许有点难懂,我们在模拟 new 之前,先看看 new 实现了哪些功能。 举个例子: // Otaku 御宅族,简称宅 function Otaku (name, age) { this.n 阅读全文
摘要:
构造函数创建对象 我们先使用构造函数创建一个对象: function Person() { } var person = new Person(); person.name = 'Kevin'; console.log(person.name) // Kevin 在这个例子中,Person 就是一个 阅读全文