Update article.md
This commit is contained in:
parent
028b80cf9d
commit
0eede58712
1 changed files with 1 additions and 1 deletions
|
@ -153,7 +153,7 @@ alert( `Called ${sayHi.counter} times` ); // Called 2 times
|
||||||
```warn header="A property is not a variable"
|
```warn header="A property is not a variable"
|
||||||
A property assigned to a function like `sayHi.counter = 0` does *not* define a local variable `counter` inside it. In other words, a property `counter` and a variable `let counter` are two unrelated things.
|
A property assigned to a function like `sayHi.counter = 0` does *not* define a local variable `counter` inside it. In other words, a property `counter` and a variable `let counter` are two unrelated things.
|
||||||
|
|
||||||
We can treat a function as an object, store properties in it, but that has no effect on its execution. Variables never use function properties and vice versa. These are just parallel words.
|
We can treat a function as an object, store properties in it, but that has no effect on its execution. Variables never use function properties and vice versa. These are just parallel worlds.
|
||||||
```
|
```
|
||||||
|
|
||||||
Function properties can replace closures sometimes. For instance, we can rewrite the counter function example from the chapter <info:closure> to use a function property:
|
Function properties can replace closures sometimes. For instance, we can rewrite the counter function example from the chapter <info:closure> to use a function property:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue