Skip to content

完成 1/02/10-ifelse 翻译#75

Merged
leviding merged 5 commits intojavascript-tutorial:zh-hansfrom
jonjia:1-js/02-first-steps/10-ifelse
May 8, 2018
Merged

完成 1/02/10-ifelse 翻译#75
leviding merged 5 commits intojavascript-tutorial:zh-hansfrom
jonjia:1-js/02-first-steps/10-ifelse

Conversation

@jonjia
Copy link
Copy Markdown
Contributor

@jonjia jonjia commented Apr 27, 2018

resolve #10

@leviding
Copy link
Copy Markdown
Member

@jonjia 所有的 importance: x 这种都不翻译

@Starriers
Copy link
Copy Markdown
Contributor

@leviding 校对认领

Copy link
Copy Markdown
Contributor

@Starriers Starriers left a comment

Choose a reason for hiding this comment

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

@jonjia @leviding 校对完成

@@ -1,10 +1,10 @@
importance: 5
重要性:5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不翻译

@@ -1,14 +1,14 @@
importance: 2
重要性:2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不翻译

'use strict';

let value = prompt('Type a number', 0);
let value = prompt('输入一个数字', 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

代码中 只翻译注解

```js run
let value = prompt('Type a number', 0);
```执行下面的 js
let value = prompt('输入一个数字', 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

同理

@@ -1,15 +1,15 @@
importance: 2
重要性:2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不翻译

![](ifelse_task.png)

Please use nested `if` blocks. Mind the overall readability of the code.
请使用潜逃的 `if` 块。注意代码整体的可读性。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

潜逃 =》 嵌套

@@ -1,12 +1,12 @@
importance: 5
重要性:5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

不翻译

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

为什么不用翻译呢?

```

We can also pass a pre-evaluated boolean value to `if`, like here:
我们也可以将未计算的布尔值传入 `if`语句,如下所示:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

语句前 空格

```

The so-called "ternary" or "question mark" operator lets us do that shorter and simpler.
所谓的“三元”或“问号”操作符让我们可以更简短地做到。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

做到 =》 到达目的。

```js
// the comparison operator "age > 18" executes first anyway
// (no need to wrap it into parentheses)
// 比较运算符“age> 18”首先执行
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

中英文前后空格

@jasonxia23
Copy link
Copy Markdown

@leviding 认领校对

@leviding
Copy link
Copy Markdown
Member

leviding commented May 5, 2018

@jasonxia23 ok

@leviding
Copy link
Copy Markdown
Member

leviding commented May 7, 2018

@jasonxia23 来校对啦

Copy link
Copy Markdown

@jasonxia23 jasonxia23 left a comment

Choose a reason for hiding this comment

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

好像忘了 Submit review 了 😅
@leviding 校对完成


---

# Show the sign
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

显示符号

我们执行下面的代码来验证:

```js run
```js 运行
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

这是 Markdown 的语法,不用翻译


```js run
let value = prompt('Type a number', 0);
```执行下面的 js
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

这是 Markdown 的语法,不用翻译。下同

- If it equals "TheMaster", then show "Welcome!",
- Another string -- show "Wrong password",
- For an empty string or cancelled input, show "Canceled."
- 如果输入的是 "TheMaster",显示"Welcome!"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

建议修改成中文引号 『』。下同

@@ -1,12 +1,12 @@
importance: 5
重要性:5
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

为什么不用翻译呢?

因为我们的眼睛垂直扫描代码。跨越多行的结构比长的水平代码更容易理解。

The idea of a question mark `?` is to return one or another value depending on the condition. Please use it for exactly that. There is `if` to execute different branches of the code.
问号 `?` 的作用是根据条件返回一个或另一个值。请正确使用它。还有 `if` 来执行代码的不同分支。
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

还有 if 来执行代码的不同分支。
=>
if 还可以用来执行代码的不同分支。

---

# if (a string with zero)
# if (值为 0 的字符串)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 构成的字符串

@leviding
Copy link
Copy Markdown
Member

leviding commented May 8, 2018

@jonjia 可以修改了

@jonjia
Copy link
Copy Markdown
Contributor Author

jonjia commented May 8, 2018

@leviding @Starriers @jasonxia23 修改完成

@leviding leviding merged commit 658d6e1 into javascript-tutorial:zh-hans May 8, 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