1.新增数据类型 Symbol
参考链接:https://www.cnblogs.com/diligenceday/p/5462733.html(基本类型)
2.proxy
用来拦截在一个对象上的指定操作,如:
var engineer = { name: 'Joe Sixpack', salary: 50 }; var interceptor = { //不仅仅有set方法,还有get...等通用的方法 set: function (receiver, property, value) { console.log(property, 'is changed to', value); receiver[property] = value; } }; engineer = new Proxy(engineer, interceptor); engineer.salary = 60; //salary is changed to 60
也可以应用在多继承:
var foo = { foo: function () { console.log("foo") } }; var bar = { bar: function () { console.log("bar") } }; var sonOfFooBar = new Proxy({}, { get: function (target, name) { console.log("target=",target); return target[name] || foo[name] || bar[name]; } }) sonOfFooBar.foo(); //"foo",有foo方法,继承自对象foo sonOfFooBar.bar(); //"bar",也有bar方法,继承自对象bar
3.reflect
博客:http://www.cnblogs.com/diligenceday/p/5474126.html