update
This commit is contained in:
parent
962caebbb7
commit
87bf53d076
1825 changed files with 94929 additions and 0 deletions
17
1-js/5-functions-closures/7-with/1-with-function/solution.md
Normal file
17
1-js/5-functions-closures/7-with/1-with-function/solution.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
Вторая (`2`), т.к. при обращении к любой переменной внутри `with` -- она ищется прежде всего в объекте.
|
||||
|
||||
Соответственно, будет выведено `2`:
|
||||
|
||||
```js
|
||||
//+ run
|
||||
function f() { alert(1) }
|
||||
|
||||
var obj = {
|
||||
f: function() { alert(2) }
|
||||
};
|
||||
|
||||
with(obj) {
|
||||
f();
|
||||
}
|
||||
```
|
||||
|
18
1-js/5-functions-closures/7-with/1-with-function/task.md
Normal file
18
1-js/5-functions-closures/7-with/1-with-function/task.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# With + функция
|
||||
|
||||
[importance 5]
|
||||
|
||||
Какая из функций будет вызвана?
|
||||
|
||||
```js
|
||||
function f() { alert(1) }
|
||||
|
||||
var obj = {
|
||||
f: function() { alert(2) }
|
||||
};
|
||||
|
||||
with(obj) {
|
||||
f();
|
||||
}
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue