var scope1 = "global scope"; function checkscope() { var scope1 = "local scope"; function f1() { return scope1; } console.log(f1); return f1; } console.log(checkscope()());