mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-03 06:03:23 -05:00
chore(i18n,learn): processed translations (#49642)
This commit is contained in:
@@ -11,13 +11,13 @@ dashedName: assignment-with-a-returned-value
|
||||
|
||||
如果你还记得我们在这一节<a href="/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator" target="_blank" rel="noopener noreferrer nofollow">使用赋值运算符存储值</a>中的讨论,赋值之前,先完成等号右边的操作。 这意味着我们可以获取函数的返回值,并将其赋值给一个变量。
|
||||
|
||||
Assume we have defined a function `sum` which adds two numbers together.
|
||||
假设我们有一个预先定义的函数 `sum` ,它将两个数相加。
|
||||
|
||||
```js
|
||||
ourSum = sum(5, 12);
|
||||
```
|
||||
|
||||
Calling the `sum` function with the arguments of `5` and `12` produces a return value of `17`. This return value is assigned to the `ourSum` variable.
|
||||
调用 `sum` 函数,参数为 `5` 和 `12`,生成的返回值为 `17`。 将返回值赋给 `ourSum` 变量。
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ dashedName: escape-sequences-in-strings
|
||||
|
||||
<pre>
|
||||
FirstLine
|
||||
\SecondLine
|
||||
\SecondLine
|
||||
ThirdLine
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -42,61 +42,61 @@ switch (val) {
|
||||
|
||||
# --hints--
|
||||
|
||||
不要使用 `else` 表达式。
|
||||
不要使用 `else` 表达式
|
||||
|
||||
```js
|
||||
assert(!/else/g.test(code));
|
||||
```
|
||||
|
||||
不要使用 `if` 表达式。
|
||||
不要使用 `if` 表达式
|
||||
|
||||
```js
|
||||
assert(!/if/g.test(code));
|
||||
```
|
||||
|
||||
你应该有至少 4 个 `break` 表达式。
|
||||
你应该有至少 4 个 `break` 表达式
|
||||
|
||||
```js
|
||||
assert(code.match(/break/g).length >= 4);
|
||||
```
|
||||
|
||||
`chainToSwitch("bob")` should return the string `Marley`
|
||||
`chainToSwitch("bob")` 应该返回字符串 `Marley`
|
||||
|
||||
```js
|
||||
assert(chainToSwitch('bob') === 'Marley');
|
||||
```
|
||||
|
||||
`chainToSwitch(42)` should return the string `The Answer`
|
||||
`chainToSwitch(42)` 应该返回字符串 `The Answer`
|
||||
|
||||
```js
|
||||
assert(chainToSwitch(42) === 'The Answer');
|
||||
```
|
||||
|
||||
`chainToSwitch(1)` should return the string `There is no #1`
|
||||
`chainToSwitch(1)` 应该返回字符串 `There is no #1`
|
||||
|
||||
```js
|
||||
assert(chainToSwitch(1) === 'There is no #1');
|
||||
```
|
||||
|
||||
`chainToSwitch(99)` should return the string `Missed me by this much!`
|
||||
`chainToSwitch(99)`应该返回字符串 `Missed me by this much!`
|
||||
|
||||
```js
|
||||
assert(chainToSwitch(99) === 'Missed me by this much!');
|
||||
```
|
||||
|
||||
`chainToSwitch(7)` should return the string `Ate Nine`
|
||||
`chainToSwitch(7)` 应该返回字符串 `Ate Nine`
|
||||
|
||||
```js
|
||||
assert(chainToSwitch(7) === 'Ate Nine');
|
||||
```
|
||||
|
||||
`chainToSwitch("John")` should return `""` (empty string)
|
||||
`chainToSwitch("John")` 应该返回 `""`(空字符串)
|
||||
|
||||
```js
|
||||
assert(chainToSwitch('John') === '');
|
||||
```
|
||||
|
||||
`chainToSwitch(156)` should return `""` (empty string)
|
||||
`chainToSwitch(156)` 应该返回 `""`(空字符串)
|
||||
|
||||
```js
|
||||
assert(chainToSwitch(156) === '');
|
||||
|
||||
Reference in New Issue
Block a user