strict mode variables | Sololearn: Learn to code for FREE!


strict mode variables

One of the JS challenge questions reads: "In strict mode, a variable without var keyword is treated as an error." The answer is True. But can't you also create variables with let and const in strict mode?

8/31/2019 7:47:48 PM


4 Answers

New Answer


Yep you can use let, var and const in strict mode :) Actually you must use them, you can't use no keyword in strict mode (which is possible in normal JS)


I see what you mean. The question is not clear. It uses the phrase 'not using var' but actually means 'not using any keyword at all'. So it's true, but is likely to be misunderstood :/ Can you report the question? Please do so if possible :)


OK. Thanks. I did go back and report it. It needs to be reworded.


So, in my mind the answer should be False. Because you can use let and const instead of var. If the answer is True that means that you have to use var or you will get an error.