Skip to content

Commit 438e7ae

Browse files
committed
work
1 parent 3f5f2ca commit 438e7ae

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

1-js/7-deeper/2-closure/article.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ But what happens when outer variables have change? Does a function get a new val
1111

1212
Also, what happens when a function travels to another place of the code -- will it get access to variables in the new place?
1313

14-
We realy should understand what's going on before doing complex things with functions. There is no general programming answer for that. Different languages behave differently. Here we'll concentrate on Javascript.
14+
We realy should understand what's going on before doing complex things with functions. There is no general programming answer for that. Different languages behave differently. Here we'll cover Javascript of course.
1515

1616
[cut]
1717

@@ -776,27 +776,24 @@ In-browser `window` is sometimes used for following purposes:
776776
```
777777

778778
````smart header="Window and \"this\""
779-
As we know, usually `this` is used inside an object method to access the object.
779+
As we know, usually `this` is used inside an object method to access the object. But there are special cases when `this` equals `window`:
780780

781-
But outside of that, sometimes `this` equals `window`:
782-
783-
- The value of the global `this` is `window`:
781+
1. The value of the global `this` is `window`:
784782

785783
```js run
786784
// outside of functions
787785
alert( this === window ); // true
788786
```
789787

790-
- When a function with `this` is called in not-strict mode:
788+
2. When a function with `this` is called in not-strict mode:
791789
```js run no-strict
792-
// not in strict mode
790+
// not in strict mode (!)
793791
function f() {
794-
alert(this); // [object Window]
792+
alert(this); // [object Window] (in strict mode would be undefined)
795793
}
796794

797795
f(); // called without an object
798796
```
799-
That's for compatibility. With `use strict` in the last example `this` would be `undefined`.
800797

801798
````
802799

1-js/plan2.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,34 @@ data-structures
5353
<<< descriptors (TODO: LATER, need JSON to output, better after inheritance to explain getOwnProps)
5454
<<< getter setter
5555
<<< NFE?
56-
<<< function is object ??
56+
<<<
5757
<<< call/apply?
5858

59+
5960
recursion (
6061
running execution context = where + lexical environment = envrec + outer
6162
context stack
6263
pow task
6364
traverse list task
6465
task: traverse list back
6566
)
67+
68+
<< function is object
69+
name property (obj props, methods, assignments - set it)
70+
length property
71+
72+
<< NFE
73+
6674
closures
6775
LE outer
6876
returning a function
6977
-not function props
7078
new Function?
7179
counter object?
7280

73-
new function
81+
<< new function
7482

83+
scheduling: settimeout, setinterval
7584

7685
bind, currying
7786
decorators

0 commit comments

Comments
 (0)