JavaScript Interview Challenge: Variable Scope and This Keyword
var value = 1;
function execute()
{
console.log(value);
var value = 2;
console.log(this.value);
this.value = 3;
}
// What will these two statements print to the console?
execute();
var instance = new execute();
Let's analyze this JavaScript interview question step by step.
1. execute() call outputs: *undefined* , *1*
...
Posted on Fri, 08 May 2026 20:03:56 +0000 by bugsuperstar37