mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-09 06:04:17 -05:00
chore(i18n,learn): processed translations (#49944)
This commit is contained in:
@@ -8,28 +8,27 @@ dashedName: record-collection
|
||||
|
||||
# --description--
|
||||
|
||||
You are creating a function that aids in the maintenance of a musical album collection. The collection is organized as an object that contains multiple albums which are also objects. Each album is represented in the collection with a unique `id` as the property name. Within each album object, there are various properties describing information about the album. Not all albums have complete information.
|
||||
你将创建一个帮助维护音乐专辑集的函数。 这个集合是一个包含多个相册的对象,这些相册也是对象。 每张专辑在集合中以唯一的 `id` 作为属性名来表示。 在每个专辑对象中,有各种描述专辑信息的属性。 并非所有专辑都有完整的信息。
|
||||
|
||||
The `updateRecords` function takes 4 arguments represented by the following function parameters:
|
||||
`updateRecords` 函数有 4 个参数,即以下参数:
|
||||
|
||||
- `records` - an object containing several individual albums
|
||||
- `id` - a number representing a specific album in the `records` object
|
||||
- `prop` - a string representing the name of the album’s property to update
|
||||
- `value` - a string containing the information used to update the album’s property
|
||||
- `records` - 一个包含多个专辑的对象
|
||||
- `id` - 一个数字,代表 `records` 对象中特定的专辑
|
||||
- `prop` - 一个字符串,代表相册属性名称
|
||||
- `value` - 一个字符串,包含用来更新相册属性的信息
|
||||
|
||||
Complete the function using the rules below to modify the object passed to the function.
|
||||
使用下面的规则完成函数来修改传递给函数的对象。
|
||||
|
||||
- Your function must always return the entire `records` object.
|
||||
- If `value` is an empty string, delete the given `prop` property from the album.
|
||||
- If `prop` isn’t `"tracks"` and `value` isn't an empty string, assign the `value` to that album’s `prop`.
|
||||
- If `prop` is `"tracks"` and `value` isn’t an empty string, add the `value` to the end of the album’s existing `"tracks"` array.
|
||||
- If the album doesn’t have a `"tracks"` property, create a new array for the album's `"tracks"` property before adding the `value` to it.
|
||||
- 你的函数必须始终返回整个 `records` 对象。
|
||||
- 如果 `value` 是空字符串,从专辑里删除指定的 `prop`。
|
||||
- If `prop` isn't `tracks` and `value` isn't an empty string, assign the `value` to that album's `prop`.
|
||||
- If `prop` is `tracks` and value isn't an empty string, add the `value` to the end of the album's `tracks` array. You need to create this array first if the album does not have a `tracks` property.
|
||||
|
||||
**Note:** A copy of the `recordCollection` object is used for the tests. You should not directly modify the `recordCollection` object.
|
||||
**注意:** 将 `recordCollection` 对象的副本用于测试。 你不应该直接修改 `recordCollection` 对象。
|
||||
|
||||
# --hints--
|
||||
|
||||
After `updateRecords(recordCollection, 5439, "artist", "ABBA")`, `artist` should be the string `ABBA`
|
||||
执行 `updateRecords(recordCollection, 5439, "artist", "ABBA")` 后,`artist` 的值应该是字符串 `ABBA`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@@ -38,7 +37,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
After `updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me")`, `tracks` should have the string `Take a Chance on Me` as the last and only element.
|
||||
执行 `updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me")` 后,`tracks` 的最后一个和唯一一个元素应该为字符串 `Take a Chance on Me`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@@ -48,14 +47,14 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
After `updateRecords(recordCollection, 2548, "artist", "")`, `artist` should not be set
|
||||
执行 `updateRecords(recordCollection, 2548, "artist", "")` 后,`artist` 不应被设置为任何值。
|
||||
|
||||
```js
|
||||
updateRecords(_recordCollection, 2548, 'artist', '');
|
||||
assert(!_recordCollection[2548].hasOwnProperty('artist'));
|
||||
```
|
||||
|
||||
After `updateRecords(recordCollection, 1245, "tracks", "Addicted to Love")`, `tracks` should have the string `Addicted to Love` as the last element.
|
||||
执行 `updateRecords(recordCollection, 1245, "tracks", "Addicted to Love")` 后,`tracks` 的最后一个元素应该为字符串 `Addicted to Love`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@@ -65,7 +64,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
After `updateRecords(recordCollection, 2468, "tracks", "Free")`, `tracks` should have the string `1999` as the first element.
|
||||
执行 `updateRecords(recordCollection, 2468, "tracks", "Free")` 后,`tracks` 的第一个元素应该为字符串 `1999`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@@ -75,14 +74,14 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
After `updateRecords(recordCollection, 2548, "tracks", "")`, `tracks` should not be set
|
||||
执行 `updateRecords(recordCollection, 2548, "tracks", "")` 后,`tracks` 不应被设置为任何值。
|
||||
|
||||
```js
|
||||
updateRecords(_recordCollection, 2548, 'tracks', '');
|
||||
assert(!_recordCollection[2548].hasOwnProperty('tracks'));
|
||||
```
|
||||
|
||||
After `updateRecords(recordCollection, 1245, "albumTitle", "Riptide")`, `albumTitle` should be the string `Riptide`
|
||||
执行 `updateRecords(recordCollection, 1245, "albumTitle", "Riptide")` 后,`albumTitle` 的值应该是字符串 `Riptide`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
||||
@@ -11,13 +11,13 @@ dashedName: word-blanks
|
||||
|
||||
给你一些不完整的句子,这些句子会缺少一些例如名词、动词、形容词或者副词之类的字词。 然后你需要使用你选择的词语去填补这些缺失的地方,使得这个句子变得完整且有意义。
|
||||
|
||||
Consider this sentence:
|
||||
考虑这句话:
|
||||
|
||||
```md
|
||||
It was really ____, and we ____ ourselves ____.
|
||||
```
|
||||
|
||||
This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows:
|
||||
这句话有三个缺失的部分 - 形容词、动词和副词,我们可以选择合适单词填入完成它。 然后将完成的句子赋值给变量,如下所示:
|
||||
|
||||
```js
|
||||
const sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
|
||||
@@ -25,21 +25,21 @@ const sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselve
|
||||
|
||||
# --instructions--
|
||||
|
||||
In this challenge, we provide you with a noun, a verb, an adjective and an adverb. You need to form a complete sentence using words of your choice, along with the words we provide.
|
||||
在这个挑战中,我们为你提供名词、动词、形容词和副词。 你需要使用合适单词以及我们提供的单词来形成完整的句子。
|
||||
|
||||
You will need to use the string concatenation operator `+` to build a new string, using the provided variables: `myNoun`, `myAdjective`, `myVerb`, and `myAdverb`. You will then assign the formed string to the `wordBlanks` variable. You should not change the words assigned to the variables.
|
||||
你需要使用字符串连接运算符 `+` 来拼接字符串变量:`myNoun`、`myAdjective`、`myVerb` 和 `myAdverb`,以构建一个新字符串。 然后,将新字符串赋给 `wordBlanks` 变量。 你不应该更改分配给变量的单词。
|
||||
|
||||
You will also need to account for spaces in your string, so that the final sentence has spaces between all the words. The result should be a complete sentence.
|
||||
你还需要考虑字符串中的空格,确保句子的所有单词之间有空格。 结果应该是一个完整的句子。
|
||||
|
||||
# --hints--
|
||||
|
||||
`wordBlanks` should be a string.
|
||||
`wordBlanks` 应该是一个字符串。
|
||||
|
||||
```js
|
||||
assert(typeof wordBlanks === 'string');
|
||||
```
|
||||
|
||||
You should not change the values assigned to `myNoun`, `myVerb`, `myAdjective` or `myAdverb`.
|
||||
你不能改变赋给 `myNoun`、`myVerb`、`myAdjective` 或者 `myAdverb` 的值。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@@ -50,7 +50,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
You should not directly use the values `dog`, `ran`, `big`, or `quickly` to create `wordBlanks`.
|
||||
你不应该直接使用 `dog`、`ran`、`big` 或 `quickly` 来创建 `wordBlanks`。
|
||||
|
||||
```js
|
||||
const newCode = removeAssignments(code);
|
||||
@@ -62,7 +62,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`wordBlanks` should contain all of the words assigned to the variables `myNoun`, `myVerb`, `myAdjective` and `myAdverb` separated by non-word characters (and any additional words of your choice).
|
||||
`wordBlanks` 应该包含分配给变量 `myNoun`、`myVerb`、`myAdjective` 和 `myAdverb` 的所有单词,用非单词字符(和你选择的任何其他单词)分隔。
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
||||
Reference in New Issue
Block a user