mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-03 15:05:01 -05:00
chore(i18n,learn): processed translations (#48105)
This commit is contained in:
@@ -37,12 +37,6 @@ assert(code.match(/quotient/g).length === 1);
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
(function(y){return 'quotient = '+y;})(quotient);
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
@@ -11,12 +11,12 @@ dashedName: escape-sequences-in-strings
|
||||
|
||||
引号不是字符串中唯一可以被转义(<dfn>escaped</dfn>)的字符。 使用转义字符有两个原因:
|
||||
|
||||
1. 首先是可以让你使用无法输入的字符,例如退格。
|
||||
1. To allow you to use characters you may not otherwise be able to type out, such as a newline.
|
||||
2. 其次是可以让你在一个字符串中表示多个引号,而不会出错。
|
||||
|
||||
我们在之前的挑战中学到了这个。
|
||||
|
||||
<table class='table table-striped'><thead><tr><th>代码</th><th>输出</th></tr></thead><tbody><tr><td><code>\'</code></td><td>单引号</td></tr><tr><td><code>\"</code></td><td>双引号</td></tr><tr><td><code>\\</code></td><td>反斜杠</td></tr><tr><td><code>\n</code></td><td>换行符</td></tr><tr><td><code>\r</code></td><td>回车符</td></tr><tr><td><code>\t</code></td><td>制表符</td></tr><tr><td><code>\b</code></td><td>退格</td></tr><tr><td><code>\f</code></td><td>换页符</td></tr></tbody></table>
|
||||
<table class='table table-striped'><thead><tr><th>代码</th><th>输出</th></tr></thead><tbody><tr><td><code>\'</code></td><td>单引号</td></tr><tr><td><code>\"</code></td><td>双引号</td></tr><tr><td><code>\\</code></td><td>反斜杠</td></tr><tr><td><code>\n</code></td><td>换行符</td></tr><tr><td><code>\t</code></td><td>tab</td></tr><tr><td><code>\r</code></td><td>carriage return</td></tr><tr><td><code>\b</code></td><td>退格</td></tr><tr><td><code>\f</code></td><td>换页符</td></tr></tbody></table>
|
||||
|
||||
*请注意,必须对反斜杠本身进行转义,它才能显示为反斜杠。*
|
||||
|
||||
@@ -78,14 +78,6 @@ assert(myStr === 'FirstLine\n\t\\SecondLine\nThirdLine');
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
(function(){
|
||||
if (myStr !== undefined){
|
||||
console.log('myStr:\n' + myStr);}})();
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
@@ -31,12 +31,6 @@ assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code));
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
if(typeof a !== 'undefined') {(function(a){return "a = " + a;})(a);} else { (function() {return 'a is undefined';})(); }
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
@@ -62,12 +62,6 @@ assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
|
||||
|
||||
# --seed--
|
||||
|
||||
## --after-user-code--
|
||||
|
||||
```js
|
||||
(function() { return "myStr = " + myStr; })();
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
@@ -98,7 +98,7 @@ function nextInLine(arr, item) {
|
||||
}
|
||||
|
||||
// Setup
|
||||
const testArr = [1, 2, 3, 4, 5];
|
||||
let testArr = [1, 2, 3, 4, 5];
|
||||
|
||||
// Display code
|
||||
console.log("Before: " + JSON.stringify(testArr));
|
||||
@@ -109,7 +109,7 @@ console.log("After: " + JSON.stringify(testArr));
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
const testArr = [1, 2, 3, 4, 5];
|
||||
let testArr = [1, 2, 3, 4, 5];
|
||||
|
||||
function nextInLine(arr, item) {
|
||||
arr.push(item);
|
||||
|
||||
@@ -71,6 +71,13 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Global variables should not be used to cache the array.
|
||||
|
||||
```js
|
||||
countdown(1)
|
||||
assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
@@ -56,6 +56,13 @@ assert.deepStrictEqual(rangeOfNumbers(6, 9), [6, 7, 8, 9]);
|
||||
assert.deepStrictEqual(rangeOfNumbers(4, 4), [4]);
|
||||
```
|
||||
|
||||
Global variables should not be used to cache the array.
|
||||
|
||||
```js
|
||||
rangeOfNumbers(1, 3)
|
||||
assert.deepStrictEqual(rangeOfNumbers(6, 9), [6, 7, 8, 9]);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
Reference in New Issue
Block a user