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(..
更多You Must Know About Object - How To Loop Through An Object In JavaScript
Loop through an Object is much harder than doing the same thing in an Array because you can’t use those convenient syntaxes like for-of, forEach (by the way, you should never use for-in) when dealing with an Object, so today let’s look at how many methods are there to loop through an Object Create an object to test12345678910111213141516171819202122functio..
更多