Will the code below cause the ReferenceError in use strict mode?

Hi all. I have not tested the use strict mode and I don’t know to use it.

But I have a question.

Will the code below that have the use strict mode enabled cause the ReferenceError error?

'use strict';
console.log(x); // do this line cause the ReferenceError error?
var x = 7;

Please answer.


What are your thoughts on this? If you’ll get a ReferenceError here is it because of use strict or would you get that error anyway?

Testing and playing around with the code is the best way to learn :wink:

open the browser console and try this code. what happens?