closure task
This commit is contained in:
parent
6be43b16a9
commit
c2a9c2da58
4 changed files with 61 additions and 0 deletions
21
1-js/06-advanced-functions/03-closure/7-let-scope/task.md
Normal file
21
1-js/06-advanced-functions/03-closure/7-let-scope/task.md
Normal 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.
|
Loading…
Add table
Add a link
Reference in a new issue