Is it possible to simulate constants in Javascript using closures?

后端 未结 4 420
余生分开走
余生分开走 2021-01-27 09:24

Is it possible to simulate constants in Javascript using closures? If so, can you please furnish me with an example?

4条回答
  •  醉酒成梦
    2021-01-27 09:46

    You can create read-only, named constants with the const keyword (Implemented in JavaScript 1.5).

提交回复
热议问题