We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我们写一个构造函数并创建一个对象
function Person() { } var person = new Person(); person.name = 'zhangsan'; console.log(person.name) // zhangsan
有一些概念
prototype
proto
constructor
原型链
有一些细节
console.log(Object.getPrototypeOf(person) === Person.prototype) // true
继承意味着复制操作,然而 JavaScript 默认并不会复制对象的属性,相反,JavaScript 只是在两个对象之间创建一个关联,这样,一个对象就可以通过委托访问另一个对象的属性和函数,所以与其叫继承,委托的说法反而更准确些。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原型和原型链
我们写一个构造函数并创建一个对象
有一些概念
prototype
proto
constructor
原型链
所以原型也是通过Object构造函数产生的
null代表着此处不该有值,意味着Object.prototype是原型链的终点
有一些细节
The text was updated successfully, but these errors were encountered: