1、ES5的循环更新
forEach indexOf map filter reduce some every
var fgoods = [1,2,3,4,5,6,7,8];
for (var i = 0; i < arr.length ; i++){
console.log(arr[i]);
}
语义化更清晰
arr.forEach (function(good){
console.log(good);
})
对象本质的更新:
增加了不可枚举对象 for in 循环不到的
增加了readonly 对象
console.log(object.prototype);
var obj = {a : 10};
var obj2 = Object.create(obj);//创建原型链
console.log(obj,obj2);
function Foo(){} //父级
functioin Ba(){} //子级
function Baz(){} //孙级
Bar.prototype = Object.create(Foo.prototype);
Baz.prototype = Object.create(Bar.prototype);
var baz = new Baz();
原型 .isPrototypeOf(实例)
该实例是否可以通过原型链找到相对应的原型;
console.log(Baz.prototype.isPrototypeOf(baz)); // true
console.log(Bar.prototype.isPrototypeOf(baz)); // true
console.log(Foo.prototype.isPrototypeOf(baz)); // true
console.log(Object.prototype.isPrototypeOf(baz)); // true
console.log(Object.prototype.isPrototypeOf({}));