Issue regarding Vanilla JavaScript template. #6616
Answered
by
JamesACS
Schnarfengargle123
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
JamesACS
Apr 28, 2022
Replies: 1 comment
-
Hey @Schnarfengargle123 - This seems to be occurring when you call the whatsThis function, it's likely to do with CodeSandbox having JS in strict mode by default, which means that undeclared variables aren't automatically global. You're also using var, which is an outdated keyword - let and const are more modern! If you move the var a within the function, it begins working |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Schnarfengargle123
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @Schnarfengargle123 - This seems to be occurring when you call the whatsThis function, it's likely to do with CodeSandbox having JS in strict mode by default, which means that undeclared variables aren't automatically global.
You're also using var, which is an outdated keyword - let and const are more modern!
If you move the var a within the function, it begins working