Modern JavaScript

From Rixort Wiki
Revision as of 16:56, 24 October 2022 by Paul (talk | contribs) (Created page with "== Defining variables == * Do not use <code>var</code> - it is not scoped to blocks (effectively it is a global variable) and it can be redefined * Use <code>const</code> for values which should not change (remember that properties of the object *can* change, even though the object pointed to cannot) * Use <code>let</code> for values which may change")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Defining variables

  • Do not use var - it is not scoped to blocks (effectively it is a global variable) and it can be redefined
  • Use const for values which should not change (remember that properties of the object *can* change, even though the object pointed to cannot)
  • Use let for values which may change