en.javascript.info/1-js/06-advanced-functions/03-closure/7-let-scope/task.md
2019-12-29 00:33:46 +03:00

21 lines
238 B
Markdown

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.