Spaces:
Running
Running
| function Person() {} | |
| const person1 = new Person(); | |
| console.log(person1.prototype); | |
| // case 1 | |
| var scope = "global scope"; | |
| function checkscope(){ | |
| var scope = "local scope"; | |
| function f(){ | |
| return scope; | |
| } | |
| return f(); | |
| } | |
| checkscope(); | |
| // case 2 | |
| var scope = "global scope"; | |
| function checkscope(){ | |
| var scope = "local scope"; | |
| function f(){ | |
| return scope; | |
| } | |
| return f; | |
| } | |
| checkscope()(); |