chore(i18n,learn): processed translations (#50821)

This commit is contained in:
camperbot
2023-06-26 19:56:15 +05:30
committed by GitHub
parent c1c5b941d8
commit 485b4772c6
329 changed files with 1229 additions and 1170 deletions

View File

@@ -51,7 +51,7 @@ assert(gloveBoxContents === 'maps');
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
```
`gloveBoxContents` should still be declared with `const`.
应该用 `const` 声明 `gloveBoxContents`
```js
assert.match(code, /const\s+gloveBoxContents\s*=/)

View File

@@ -9,25 +9,25 @@ dashedName: generate-random-whole-numbers-with-javascript
# --description--
You can generate random decimal numbers with `Math.random()`, but sometimes you need to generate random whole numbers. The following process will give you a random whole number less than `20`:
你可以用 `Math.random()` 生成随机的小数,但有时你需要生成随机的整数。 下面的流程将给你一个小于 `20` 的随机整数:
1. Use `Math.random()` to generate a random decimal number.
2. Multiply that random decimal number by `20`.
3. Use `Math.floor()` to round this number down to its nearest whole number.
1. `Math.random()` 生成一个随机小数。
2. 把这个随机小数乘以 `20`
3. `Math.floor()` 向下取整,获得它最近的整数。
Remember that `Math.random()` can never quite return a `1`, so it's impossible to actually get `20` since you are rounding down with `Math.floor()`. This process will give you a random whole number in the range from `0` to `19`.
记住 `Math.random()` 永远不能完全返回 `1`,所以不可能实际得到 `20`,因为你正在用 `Math.floor()` 四舍五入。 这个流程将给你一个从 `0` `19` 的随机整数。
Putting everything together, this is what your code looks like:
把操作连起来,代码类似于下面:
```js
Math.floor(Math.random() * 20);
```
You are calling `Math.random()`, multiplying the result by 20, then passing the value to `Math.floor()` to round the value down to the nearest whole number.
你将调用 `Math.random()`,把结果乘以 20然后把值传给 `Math.floor()`,向下取整获得最近的整数。
# --instructions--
Use this technique to generate and return a random whole number in the range from `0` to `9`.
使用这个方法生成并返回 `0` `9` 之间的随机整数。
# --hints--
@@ -49,7 +49,7 @@ assert(
assert(code.match(/Math.random/g).length >= 1);
```
You should have multiplied the result of `Math.random` by 10 to make it a number in the range from zero to nine.
应该将 `Math.random` 的结果乘以 10以生成 0 到 9 之间的随机数。
```js
assert(

View File

@@ -9,11 +9,11 @@ dashedName: generate-random-whole-numbers-within-a-range
# --description--
You can generate a random whole number in the range from zero to a given number. You can also pick a different lower number for this range.
你可以在从零到给定数字的范围内生成随机整数。 你也可以为此范围选择一个不同的较小数字。
You'll call your minimum number `min` and your maximum number `max`.
你将把最小的数字定义为 `min`,把最大的数字定义为 `max`
This formula gives a random whole number in the range from `min` to `max`. 仔细看看并尝试理解这行代码到底在干嘛:
这个公式将生成一个从 `min` `max` 的随机整数。 仔细看看并尝试理解这行代码到底在干嘛:
```js
Math.floor(Math.random() * (max - min + 1)) + min
@@ -21,7 +21,7 @@ Math.floor(Math.random() * (max - min + 1)) + min
# --instructions--
Create a function called `randomRange` that takes a range `myMin` and `myMax` and returns a random whole number that's greater than or equal to `myMin` and less than or equal to `myMax`.
创建一个函数 `randomRange`,参数为 `myMin` `myMax`,返回一个在 `myMin`(包括 myMin`myMax`(包括 myMax之间的随机整数。
# --hints--

View File

@@ -22,7 +22,7 @@ dashedName: record-collection
- 你的函数必须始终返回整个 `records` 对象。
- 如果 `value` 是空字符串,从专辑里删除指定的 `prop`
- 如果 `prop` 不是 `tracks`,并且 `value` 不是一个空字符串,将 `value` 赋给那个专辑的 `prop`
- If `prop` is `tracks` and `value` isn't an empty string, you need to update the album's `tracks` array. First, if the album does not have a `tracks` property, assign it an empty array. Then add the `value` as the last item in the album's `tracks` array.
- 如果 `prop` `tracks` 并且 `value` 不是一个空字符串,你需要更新专辑的 `tracks` 数组。 首先,如果专辑没有 `tracks` 属性,赋予它一个空数组。 然后添加 `value` 作为专辑的 `tracks` 数组的最后一个项目。
**注意:**`recordCollection` 对象的副本用于测试。 你不应该直接修改 `recordCollection` 对象。

View File

@@ -8,7 +8,7 @@ dashedName: testing-objects-for-properties
# --description--
To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
要检查某个对象是否具有一个属性,你可以使用 `.hasOwnProperty()` 方法。 根据对象是否具有该属性,`someObject.hasOwnProperty(someProperty)` 返回 `true` `false`
**示例**
@@ -21,11 +21,11 @@ checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
The first `checkForProperty` function call returns `true`, while the second returns `false`.
第一个 `checkForProperty` 函数返回 `true`,第二个返回 `false`
# --instructions--
Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
修改函数 `checkObj` 以检查传给函数参数的对象 `obj` 是否包含传给函数参数的属性 `checkProp`。 如果在 `obj` 中找到传给 `checkProp` 的属性,则返回该属性的值。 如果没有,则返回 `Not Found`
# --hints--