while using strict mode
I'm getting type error
to access the var
using this
.
"use strict";
var bar = "global";
function foo() {
console.log(this.bar);
}
var obj1 = {
bar: "obj1",
foo: foo
};
var obj2 = {
bar: "obj2"
};
foo();
obj1.foo();
foo.call(obj2);
new foo();
Screen shot:
foo();
is causing the problem. if I remove "use strict"
everything is working fine.
Thanks in advance.