5,323
edits
(→Enums) |
(→Enums) |
||
Line 96: | Line 96: | ||
; Notes | ; Notes | ||
* This does not enforce any kind of type. If you need that, use [https://www.typescriptlang.org/docs/handbook/enums.html typescript enums]. | * This does not enforce any kind of type. If you need that, use [https://www.typescriptlang.org/docs/handbook/enums.html typescript enums]. | ||
===<code>var</code> vs <code>let</code>, <code>const</code>=== | |||
* <code>var</code> is the old way of declaring variables. It has function-scope rather than block-scope. Note that <code>var</code> can also be redefined without errors. | |||
* <code>let</code> and <code>const</code> are post-ES6 ways which have block-scope. | |||
These days you should never use <code>var<code>. | |||
The Google [https://google.github.io/styleguide/jsguide.html JS Style Guide] and [https://google.github.io/styleguide/tsguide.html TS Style Guide] suggest using <code>const</code> by default. | |||
==Browser Usage== | ==Browser Usage== |