replace
This commit is contained in:
parent
e2443e8de6
commit
75e30539ef
73 changed files with 195 additions and 195 deletions
|
@ -15,7 +15,7 @@ The error message in most browsers does not give understanding what went wrong.
|
|||
|
||||
**The error appears because a semicolon is missing after `user = {...}`.**
|
||||
|
||||
Javascript does not assume a semicolon before a bracket `(user.go)()`, so it reads the code like:
|
||||
JavaScript does not assume a semicolon before a bracket `(user.go)()`, so it reads the code like:
|
||||
|
||||
```js no-beautify
|
||||
let user = { go:... }(user.go)()
|
||||
|
|
|
@ -36,4 +36,4 @@ Modify the code of `up` and `down` to make the calls chainable, like this:
|
|||
ladder.up().up().down().showStep(); // 1
|
||||
```
|
||||
|
||||
Such approach is widely used across Javascript libraries.
|
||||
Such approach is widely used across JavaScript libraries.
|
||||
|
|
|
@ -11,7 +11,7 @@ let user = {
|
|||
|
||||
And, in the real world, a user can `act`: to select something from the shopping cart, to login, to logout etc.
|
||||
|
||||
Let's implement the same in Javascript using functions in properties.
|
||||
Let's implement the same in JavaScript using functions in properties.
|
||||
|
||||
[cut]
|
||||
|
||||
|
@ -164,7 +164,7 @@ If we used `this.name` instead of `user.name` inside the `alert`, then the code
|
|||
|
||||
## "this" is not bound
|
||||
|
||||
In Javascript, "this" keyword behaves unlike most other programming languages. First, it can be used in any function.
|
||||
In JavaScript, "this" keyword behaves unlike most other programming languages. First, it can be used in any function.
|
||||
|
||||
There's no syntax error in the code like that:
|
||||
|
||||
|
@ -227,7 +227,7 @@ Here we are not to judge whether this language design decision is good or bad. W
|
|||
## Internals: Reference Type
|
||||
|
||||
```warn header="In-depth language feature"
|
||||
This section covers advanced topic that may interest those who want to know Javascript better.
|
||||
This section covers advanced topic that may interest those who want to know JavaScript better.
|
||||
|
||||
If you want to go on faster, it can be skipped or postponed.
|
||||
```
|
||||
|
@ -279,7 +279,7 @@ hi(); // Error, because this is undefined
|
|||
|
||||
That's because a function is a value of its own. It does not carry the object. So `hi = user.hi` saves it into the variable, and then on the last line it is completely standalone.
|
||||
|
||||
**To make `user.hi()` calls work, Javascript uses a trick -- the dot `'.'` returns not a function, but a value of the special [Reference Type](https://tc39.github.io/ecma262/#sec-reference-specification-type).**
|
||||
**To make `user.hi()` calls work, JavaScript uses a trick -- the dot `'.'` returns not a function, but a value of the special [Reference Type](https://tc39.github.io/ecma262/#sec-reference-specification-type).**
|
||||
|
||||
The Reference Type is a "specification type". We can't explicitly use it, but it is used internally by the language.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue