根据阮一峰老师《ECMAScript 6 入门》概要整理的es6思维导图
ES6规范 http://www.ecma-international.org/ecma-262/6.0/
学习 分享 成长
这里整理ES6新特性以及跟ES5的对比用法
1.const 常量定义
const URL="https://zhangxuefei.site";
定义的常量不能被直接赋值修改,但是如果a=URL,那么a的值是可以修改的,如果PI是一个引用类型,那么对a的修改也会影响到URL
ES5定义如下:
Object.defineProperty(typeof global==="object"?global:window,"URL",{ value:"https://zhangxuefei.site", enumerable:true, writable:false, //不能赋值 configurable:false //不能delete }); URL=2; console.log(URL);//https://zhangxuefei.site