closure task

This commit is contained in:
Ilya Kantor 2019-12-29 00:33:46 +03:00
parent 6be43b16a9
commit c2a9c2da58
4 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,21 @@
importance: 4
---
# Is variable visible?
What will be the result of this code?
```js
let x = 1;
function func() {
console.log(x); // ?
let x = 2;
}
func();
```
P.S. There's a pitfall in this task. The solution is not obvious.