3 ms·
'use strict' solves the forgotten 'var' and dangerous 'with' by prohibiting these parts of language. Also if you are using ES2016+ you are most likely compiling
by Hurtak 10y ago
'use strict' solves the forgotten 'var' and dangerous 'with' by prohibiting these parts of language. Also if you are using ES2016+ you are most likely compiling your code with Babel (to have more backwards compatibility) it will turn on the strict mode on by default.
- xiaoma 10y ago"use strict" will save you from some of the foot guns but not all of them. E.g. it still allows the double equal comparisons I mentioned above, which have been the source of some frustrating debugging sessions ever. If you want a safe language on the front end, use Elm.