Answer the question
In order to leave comments, you need to log in
What happens if you declare a variable in js without the word var, const or let?
Variables declared inside a function without a keyword will become global variables
Answer the question
In order to leave comments, you need to log in
strict mode only tells the browser to process a particular module/script/function in ES5+ mode.
Prior to ES5, it was allowed that you create a variable without a VAR, then it was added to the global scope (in the browser this is window). The ES5+ standards don't allow this. That is, it will not be possible to simply answer your question. ES5+ will throw an error. And since there were no const and let in the standards before, it is not correct to ask such a question.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question