+ 1

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?

31st Aug 2019, 7:47 PM
Heather
Heather - avatar
4 Answers
+ 1
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)
31st Aug 2019, 7:49 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
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 :)
31st Aug 2019, 7:58 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
OK. Thanks. I did go back and report it. It needs to be reworded.
31st Aug 2019, 8:05 PM
Heather
Heather - avatar
0
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.
31st Aug 2019, 7:53 PM
Heather
Heather - avatar