Skip to content

Commit 1bff026

Browse files
authored
Merge branch 'master' into master
2 parents a750ee9 + e32a446 commit 1bff026

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README-zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ console.log(sarah)
393393

394394
#### 答案: A
395395

396-
对于 `sarah`,我们没有使用 `new` 关键字。当使用 `new` 时,`this` 引用我们创建的空对象当未使用 `new` 时,`this` 引用的是**全局对象**(global object)。
396+
对于 `sarah`,我们没有使用 `new` 关键字。当使用 `new` 时,`this` 引用我们创建的空对象当未使用 `new` 时,`this` 引用的是**全局对象**(global object)。
397397

398398
我们说 `this.firstName` 等于 `"Sarah"`,并且 `this.lastName` 等于 `"Smith"`。实际上我们做的是,定义了 `global.firstName = 'Sarah'``global.lastName = 'Smith'`。而 `sarah` 本身是 `undefined`
399399

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ console.log(b === c);
229229

230230
`new Number()` is a built-in function constructor. Although it looks like a number, it's not really a number: it has a bunch of extra features and is an object.
231231

232-
When we use the `==` operator, it only checks whether it has the same _value_. They do they both have the value of `3`, so it returns `true`.
232+
When we use the `==` operator, it only checks whether it has the same _value_. They both have the value of `3`, so it returns `true`.
233233

234234
However, when we use the `===` operator, both value _and_ type should be the same. It's not: `new Number()` is not a number, it's an **object**. Both return `false.`
235235

@@ -629,7 +629,7 @@ With `"use strict"`, you can make sure that you don't accidentally declare globa
629629

630630
---
631631

632-
###### 21. What's the output?
632+
###### 21. What's value of `sum`?
633633

634634
```javascript
635635
const sum = eval("10*10+5");
@@ -1180,6 +1180,8 @@ JavaScript only has primitive types and objects.
11801180

11811181
Primitive types are `boolean`, `null`, `undefined`, `bigint`, `number`, `string`, and `symbol`.
11821182

1183+
What differentiates a primitive from an object is that primitives do not have any properties or methods; however, you'll note that `'foo'.toUpperCase()` evaluates to `'FOO'` and does not result in a `TypeError`. This is because when you try to access a property or method on a primitive like a string, JavaScript will implicity wrap the object using one of the wrapper classes, i.e. `String`, and then immediately discard the wrapper after the expression evaluates. All primitives except for `null` and `undefined` exhibit this behaviour.
1184+
11831185
</p>
11841186
</details>
11851187

0 commit comments

Comments
 (0)