Leo Liu's blog

标签 · Object

首页

关于

归档

JavascriptObject

What Did new Keyword, Object.create() Do In Javascript

We can use both new and Object.create() implement inherantance in javascript: 12345678910111213141516171819202122// newfunction People(name) { this.name = name;}People.prototype.sayName = function () { console.log(this.name);};var leo = new People("leo");// object.create()var People = { name: "liu", sayName(..

更多