完成 1/02/10-ifelse 翻译#75
Merged
leviding merged 5 commits intojavascript-tutorial:zh-hansfrom May 8, 2018
jonjia:1-js/02-first-steps/10-ifelse
Merged
完成 1/02/10-ifelse 翻译#75leviding merged 5 commits intojavascript-tutorial:zh-hansfrom jonjia:1-js/02-first-steps/10-ifelse
leviding merged 5 commits intojavascript-tutorial:zh-hansfrom
jonjia:1-js/02-first-steps/10-ifelse
Conversation
Member
|
@jonjia 所有的 importance: x 这种都不翻译 |
Contributor
|
@leviding 校对认领 |
Starriers
reviewed
May 5, 2018
| @@ -1,10 +1,10 @@ | |||
| importance: 5 | |||
| 重要性:5 | |||
| @@ -1,14 +1,14 @@ | |||
| importance: 2 | |||
| 重要性:2 | |||
| 'use strict'; | ||
|
|
||
| let value = prompt('Type a number', 0); | ||
| let value = prompt('输入一个数字', 0); |
| ```js run | ||
| let value = prompt('Type a number', 0); | ||
| ```执行下面的 js | ||
| let value = prompt('输入一个数字', 0); |
| @@ -1,15 +1,15 @@ | |||
| importance: 2 | |||
| 重要性:2 | |||
|  | ||
|
|
||
| Please use nested `if` blocks. Mind the overall readability of the code. | ||
| 请使用潜逃的 `if` 块。注意代码整体的可读性。 |
| @@ -1,12 +1,12 @@ | |||
| importance: 5 | |||
| 重要性:5 | |||
| ``` | ||
|
|
||
| We can also pass a pre-evaluated boolean value to `if`, like here: | ||
| 我们也可以将未计算的布尔值传入 `if`语句,如下所示: |
| ``` | ||
|
|
||
| The so-called "ternary" or "question mark" operator lets us do that shorter and simpler. | ||
| 所谓的“三元”或“问号”操作符让我们可以更简短地做到。 |
| ```js | ||
| // the comparison operator "age > 18" executes first anyway | ||
| // (no need to wrap it into parentheses) | ||
| // 比较运算符“age> 18”首先执行 |
|
@leviding 认领校对 |
Member
|
@jasonxia23 ok |
Member
|
@jasonxia23 来校对啦 |
jasonxia23
reviewed
May 7, 2018
|
|
||
| --- | ||
|
|
||
| # Show the sign |
| 我们执行下面的代码来验证: | ||
|
|
||
| ```js run | ||
| ```js 运行 |
|
|
||
| ```js run | ||
| let value = prompt('Type a number', 0); | ||
| ```执行下面的 js |
| - If it equals "TheMaster", then show "Welcome!", | ||
| - Another string -- show "Wrong password", | ||
| - For an empty string or cancelled input, show "Canceled." | ||
| - 如果输入的是 "TheMaster",显示"Welcome!", |
| @@ -1,12 +1,12 @@ | |||
| importance: 5 | |||
| 重要性:5 | |||
| 因为我们的眼睛垂直扫描代码。跨越多行的结构比长的水平代码更容易理解。 | ||
|
|
||
| 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` 来执行代码的不同分支。 |
There was a problem hiding this comment.
还有 if 来执行代码的不同分支。
=>
if 还可以用来执行代码的不同分支。
| --- | ||
|
|
||
| # if (a string with zero) | ||
| # if (值为 0 的字符串) |
Member
|
@jonjia 可以修改了 |
Contributor
Author
leviding
approved these changes
May 8, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolve #10