-
Notifications
You must be signed in to change notification settings - Fork 1.2k
1 js/05 data types/05 array methods #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1 js/05 data types/05 array methods #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢校对
@@ -9,23 +9,23 @@ str.test = 5; // (*) | |||
alert(str.test); | |||
``` | |||
|
|||
There may be two kinds of result: | |||
这里有两种结果: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
结果 本身包含总结的意思 具有选择性。 原来意思就是二选一。 如果用可能就改变原来意思
@@ -102,25 +102,25 @@ if (zero) { // zero is true, because it's an object | |||
} | |||
``` | |||
|
|||
On the other hand, using the same functions `String/Number/Boolean` without `new` is a totally sane and useful thing. They convert a value to the corresponding type: to a string, a number, or a boolean (primitive). | |||
另一方面,不使用 `new` 的 `String/Number/Boolean` 是一个明智的选择。它们将一个值转换为相应的类型:转成 string,number,或 boolean(原始类型)。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String/Number/Boolean 不是方法,是构造函数
@athena0304 @leviding 因为内容太熟悉了,所以存在忽略现象,感谢指正,以后一定会格外谨慎。 |
|
||
`arr.sort(fn)` 方法内置实现排序算法。我们不需要关心它是如何工作的(优化过的 [quicksort](https://en.wikipedia.org/wiki/Quicksort))。它将自动遍历数组,使用提供的函数比较它的元素并对它们重新排序,我们所需要的只是提供用于比较的函数 `fn`。 | ||
`arr.sort(fn)` 方法内置实现排序算法。我们不需要关心它是如何工作的(大多数情况下是优化过的[快速排序](https://en.wikipedia.org/wiki/Quicksort))算法。它将自动遍历数组,使用提供的函数比较它的元素并对它们重新排序,我们所需要的只是提供用于比较的函数 `fn`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【算法】应该在括号里面
@@ -46,6 +46,6 @@ let usersMapped = users.map(user => *!*({*/!* | |||
})); | |||
``` | |||
|
|||
Now fine. | |||
也就是把 `value => {...}` 缓存 `value => ({...})`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句是怎么翻译过来的?原文就是 Now fine.
|
||
The syntax is: | ||
语法: | ||
|
||
```js | ||
let result = arr.map(function(item, index, array) { | ||
// returns the new value instead of item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunhaokk 这里注释需要翻译
@leviding thanks |
#61
@leviding 好长,翻译完毕