How to use 'strict mode'

InstructorTyler Clark

Share this video with your friends

Send Tweet

Strict mode catches silent errors and throws them, fixes mistakes that can make it difficult for JavaScript engines to perform optimizations, and prohibits some syntax likely to be defined in future versions of ECMAScript. It can be used within entire scripts or to individual functions (does not apply to block statements). In this lesson we talk about some of these strict mode catches and see how to implement strict mode.

Andrea Bugada
~ 5 years ago

There is a typo in the transcript:

js'use strict'

var undefined = 5

var Infinity = 5

Uncaught TypeError: Cannot create property 'first'

'first' should be 'undefined'