JavaScript之ECMAScript6新特性之_01_开篇
程序员文章站
2022-07-05 23:43:00
...
点此查看全部:
http://es6-features.org
Constants
Constants
Support for constants (also known as "immutable variables"), i.e., variables which cannot be re-assigned new content. Notice: this only makes the variable itself immutable, not its assigned content (for instance, in case the content is an object, this means the object itself can still be altered).
http://es6-features.org
Constants
Constants
Support for constants (also known as "immutable variables"), i.e., variables which cannot be re-assigned new content. Notice: this only makes the variable itself immutable, not its assigned content (for instance, in case the content is an object, this means the object itself can still be altered).
const PI = 3.141593 PI > 3.0
// only in ES5 through the help of object properties // and only in global context and not in a block scope Object.defineProperty(typeof global === "object" ? global : window, "PI", { value: 3.141593, enumerable: true, writable: false, configurable: false }) PI > 3.0;
上一篇: JavaScript之 25 道面试题
下一篇: 网站页面配色
推荐阅读
-
JavaScript之ECMAScript6新特性之_01_开篇
-
浅谈ECMAScript6新特性之let、const
-
Dreamweaver CS4新特性之JavaScript
-
JavaScript之ECMAScript6新特性之_02_线程异步阻塞: Promise, Async / await
-
JavaScript之ECMAScript6新特性之_03_箭头函数(Arrow Function)
-
探讨:JavaScript ECAMScript5 新特性之get/set访问器_javascript技巧
-
探讨:JavaScript ECAMScript5 新特性之get/set访问器_javascript技巧
-
ECMAScript6新特性之let、const(图文教程)
-
ECMAScript6新特性之let、const(图文教程)