خرید بک لینک

Vote count: 0

So I've been studying for a job interview, and started digging into Javascript. Came up with this.

So:

"use strict";

var x = 0;
var y = 0;

eval("x=3;y=11;"); //direct call to eval in global scope

console.log("x: " + x); // outputs 3
console.log("y: " + y); // outputs 11

But:

"use strict";

var x = 0;

(0, eval)("x=3;y=11;"); //indirect call to eval in global scope

console.log("x: " + x); // outputs 0 because the strict mode won't allow the reassignment? 
console.log("y: " + y); // outputs 11

I don't know/understand what happens with the x when the eval is executed. I know with strict mode off the assignment goes through no problem. Would anyone be willing to explain this to me? Thanks!

asked 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 25 فروردين 1395 ساعت: 23:43

صفحه بندی