Message from JavaScript discussions

May 2017

— Or, it did not work, actually... the vm doesn't apply strict mode properly so i will try again in a REPL

Message permanent page

— 

Language:

js


Source:
'use strict';
(function(a) {
console.log(arguments);
})(1, 2);

(function(a) {
'use strict';
console.log(arguments);
})(1, 2);


Result:
{ '0': 1, '1': 2 }
{ '0': 1, '1': 2 }

— Hmm, I thought arguments wasn't available in strict

— I am specifically checking if variable declarations without var or other prefix throw an error, which they should in strict mode

Message permanent page

— Ah

— That's a good way

— In the browser VM this code does not run in strict mode

"use strict";
function myFunc () {
b = 456;
}
myFunc();

Message permanent page

— What about with use strict inside the function?

— No effect

— Which browser?

— Chrome

— That's weird