DEV Community

Discussion on: JavaScript `use strict` Explained in 2 Minutes

Collapse
 
ankitbeniwal profile image
Ankit Beniwal • Edited

Also, 'use strict' prevents variable/object hoisting i.e. JavaScript in strict mode does not allow variables to be used if they are not declared.

Best practice is to move the variable declarations to the top of the script.

Collapse
 
gaberomualdo profile image
Gabe Romualdo • Edited

Good point, thank you for commenting!

— Gabriel