Skip to content

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

Conversation

sunhaokk
Copy link
Contributor

#61
@leviding 好长,翻译完毕

Copy link
Contributor Author

@sunhaokk sunhaokk left a 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:
这里有两种结果:
Copy link
Contributor Author

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` 是一个明智的选择。它们将一个值转换为相应的类型:转成 stringnumber,或 boolean(原始类型)。
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String/Number/Boolean 不是方法,是构造函数

@hannahGu
Copy link

hannahGu commented Jun 5, 2018

@athena0304 @leviding 因为内容太熟悉了,所以存在忽略现象,感谢指正,以后一定会格外谨慎。


`arr.sort(fn)` 方法内置实现排序算法。我们不需要关心它是如何工作的(优化过的 [quicksort](https://en.wikipedia.org/wiki/Quicksort))。它将自动遍历数组,使用提供的函数比较它的元素并对它们重新排序,我们所需要的只是提供用于比较的函数 `fn`。
`arr.sort(fn)` 方法内置实现排序算法。我们不需要关心它是如何工作的(大多数情况下是优化过的[快速排序](https://en.wikipedia.org/wiki/Quicksort))算法。它将自动遍历数组,使用提供的函数比较它的元素并对它们重新排序,我们所需要的只是提供用于比较的函数 `fn`。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【算法】应该在括号里面

@leviding leviding added the WIP Work in process label Jun 8, 2018
@@ -46,6 +46,6 @@ let usersMapped = users.map(user => *!*({*/!*
}));
```

Now fine.
也就是把 `value => {...}` 缓存 `value => ({...})`。
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sunhaokk 这里注释需要翻译

@leviding leviding added enhancement New feature or request and removed WIP Work in process labels Jun 9, 2018
@sunhaokk
Copy link
Contributor Author

@leviding thanks

@leviding leviding added WIP Work in process and removed enhancement New feature or request labels Jun 11, 2018
@leviding leviding merged commit 1eab285 into javascript-tutorial:zh-hans Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants