I am currently learning Javascript and came across the term "strict mode". I know that it is used to indicate to the compiler that the code should be examined stricter. Then I went on testing this: first I tried this:
function test() { "use strict"; a = 4; alert(a); } I didn't get an alert and thought that it is quite logical as an error is thrown because "a" is not defined. Then I tried this:
{ "use strict"; a = 4; alert(a); } After refreshing the page an alert was shown saying "4". So my question is when is the strict mode "working" and when it isn't?