chore(i18n,curriculum): update translations (#43463)

This commit is contained in:
camperbot
2021-09-18 11:22:53 -07:00
committed by GitHub
parent 81d48b26ad
commit 15be1fe6bb
164 changed files with 1081 additions and 372 deletions

View File

@ -1,6 +1,6 @@
---
id: 561add10cb82ac38a17523bc
title: 后端开发和API证
title: 后端开发和 API
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 5e46fc95ac417301a38fb934
title: Python 与数据分析证
title: Python 与数据分析
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 5a553ca864b52e1d8bceea14
title: Data Visualization Certification
title: 数据可视化认证
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 561acd10cb82ac38a17513bc
title: 前端开发库证
title: 前端开发库
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 5e6021435ac9d0ecd8b94b00
title: 信息安全证
title: 信息安全
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 561abd10cb81ac38a17513bc
title: JavaScript 算法和数据结构证
title: JavaScript 算法和数据结构
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 660add10cb82ac38a17513be
title: 旧版后端证
title: 旧版后端
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 561add10cb82ac39a17513bc
title: 旧版数据可视化证
title: 旧版数据可视化
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 561add10cb82ac38a17513be
title: 旧版前端证
title: 旧版前端
challengeType: 7
isPrivate: true
tests:

View File

@ -6,19 +6,19 @@ isPrivate: true
tests:
-
id: 561add10cb82ac38a17513bc
title: 响应式网页设计证书
title: 响应式 Web 设计认证
-
id: 561abd10cb81ac38a17513bc
title: JavaScript 算法和数据结构证
title: JavaScript 算法和数据结构
-
id: 561acd10cb82ac38a17513bc
title: 前端库证
title: 前端库
-
id: 5a553ca864b52e1d8bceea14
title: 数据可视化证
title: 数据可视化
-
id: 561add10cb82ac38a17523bc
title: API 和微服务证
title: API 和微服务
-
id: 561add10cb82ac38a17213bc
title: 旧版信息安全和质量保证证
title: 旧版信息安全和质量保证

View File

@ -1,6 +1,6 @@
---
id: 561add10cb82ac38a17213bc
title: 旧版信息安全和质量保证证
title: 旧版信息安全和质量保证
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 5e46fc95ac417301a38fb935
title: Machine Learning with Python Certification
title: Python 与机器学习认证
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 5e611829481575a52dc59c0e
title: 质量保证证
title: 质量保证
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 606243f50267e718b1e755f4
title: 关系数据库证
title: 关系数据库
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 561add10cb82ac38a17513bc
title: 响应式网页设计认证项目
title: 响应式 Web 设计认证
challengeType: 7
isPrivate: true
tests:

View File

@ -1,6 +1,6 @@
---
id: 5e44431b903586ffb414c951
title: Python 与科学计算证
title: Python 与科学计算
challengeType: 7
isPrivate: true
tests:

View File

@ -10,7 +10,7 @@ dashedName: prevent-object-mutation
通过之前的挑战可以看出,`const` 声明并不会真的保护数据不被改变。 为了确保数据不被改变JavaScript 提供了一个函数 `Object.freeze`
当一个对象被冻结的时候,你不能再对它的属性再进行增、删、改的操作。 任何试图改变对象的操作都会被阻止,却不会报错
任何更改对象的尝试都将被拒绝,如果脚本在严格模式下运行,将抛出错误
```js
let obj = {
@ -23,7 +23,7 @@ obj.newProp = "Test";
console.log(obj);
```
`obj.review``obj.newProp` 赋值将导致错误,控制台将显示值 `{ name: "FreeCodeCamp", review: "Awesome" }`
`obj.review``obj.newProp` 赋值将导致错误,因为我们的编辑器默认在严格模式下运行,控制台将显示值 `{ name: "FreeCodeCamp", review: "Awesome" }`
# --instructions--

View File

@ -38,7 +38,7 @@ JavaScript 的默认排序方法是 Unicode 值顺序排序,有时可能会得
# --instructions--
`alphabeticalOrder` 函数中使用 `sort` 方法对 `arr` 中的元素按照字母顺序排列。
`alphabeticalOrder` 函数中使用 `sort` 方法对 `arr` 中的元素按照字母顺序排列。 该函数应返回一个排序的数组。
# --hints--
@ -83,7 +83,7 @@ assert(
function alphabeticalOrder(arr) {
// Only change code below this line
return arr
// Only change code above this line
}
alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);

View File

@ -12,7 +12,7 @@ dashedName: add-font-awesome-icons-to-our-buttons
# --description--
Font Awesome 是一个非常便利的图标库。 我们可以通过 webfont 或矢量图的方式来使用这些图标。 这些图标就和字体一样, 不仅能通过像素单位指定它们的大小,它们也同样会继承父级 HTML 元素的字体大小
Font Awesome 是一个非常便利的图标库。 我们可以通过 webfont 或矢量图的方式来使用这些图标。 这些图标就和字体一样, 不仅能通过像素单位指定它们的大小,它们也同样会继承父级 HTML 元素的字
可以将 Font Awesome 图标库添加至任何一个 web app 中,方法很简单,只需要在 HTML head 标签中添加以下代码即可:

View File

@ -12,7 +12,7 @@ Bootstrap 有着丰富的预定义按钮颜色。 浅蓝色的 `btn-info` class
`Like` 按钮下方创建包含文本 `Info` 的块级 Bootstrap 按钮,然后为该按钮添加 Bootstrap 的 `btn-info``btn-block` classes。
注意:这些按钮仍然需要 `btn``btn-block` classes
注意:这些按钮仍然需要 `btn``btn-block` class。
# --hints--

View File

@ -29,7 +29,7 @@ assert(
assert($('button').hasClass('btn') && $('button').hasClass('btn-default'));
```
所有 `button` 元素都有一个闭合标签。
保所有 `button` 元素都有闭合标签。
```js
assert(

View File

@ -10,9 +10,9 @@ dashedName: build-a-25--5-clock
**目标:** 在 [CodePen.io](https://codepen.io) 上实现一个功能类似 <https://codepen.io/freeCodeCamp/full/XpKrrW> 的 App。
在满足以下[需求](https://en.wikipedia.org/wiki/User_story)并能通过所有测试的前提下, 可以根据自己的喜好来美化 app
在满足以下 [需求](https://en.wikipedia.org/wiki/User_story) 并能通过所有测试的前提下, 赋予它你自己的个人风格
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 如果使用建议的技术栈完成这个项目,我们会接受并尝试修复相关的问题反馈。 编码愉快!
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战;不推荐使用前面没有提到的技术,否则风险自负。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复你在使用推荐技术栈创建项目时报告的问题。 编码愉快!
**需求 1** 应该能看到一个具有`id="break-label"`属性的元素,这个元素的内容应该是一个字符串(例如:"Break Length")。

View File

@ -10,9 +10,9 @@ dashedName: build-a-drum-machine
**目标:** 在 [CodePen.io](https://codepen.io) 上实现一个功能类似 <https://codepen.io/freeCodeCamp/full/MJyNMd> 的 App。
在满足以下[需求](https://en.wikipedia.org/wiki/User_story)并能通过所有测试的前提下, 可以根据自己的喜好来美化 app
在满足以下 [需求](https://en.wikipedia.org/wiki/User_story) 并能通过所有测试的前提下, 赋予它你自己的个人风格
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复使用推荐技术栈遇到的反馈问题。 编码愉快!
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复你在使用推荐技术栈创建项目时报告的问题。 编码愉快!
**需求 1** 应该可以看到一个具有 `id="drum-machine"` 属性的外层容器,该容器包含了其它所有元素。

View File

@ -10,9 +10,9 @@ dashedName: build-a-javascript-calculator
**目标:** 在 [CodePen.io](https://codepen.io) 上实现一个功能类似 <https://codepen.io/freeCodeCamp/full/wgGVVX> 的 App。
在满足以下[需求](https://en.wikipedia.org/wiki/User_story)并能通过所有测试的前提下, 可以根据自己的喜好来美化 app
在满足以下 [需求](https://en.wikipedia.org/wiki/User_story) 并能通过所有测试的前提下, 赋予它你自己的个人风格
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复使用推荐技术栈遇到的反馈问题。 编码愉快!
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战;不推荐使用前面没有提到的技术,否则风险自负。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复你在使用推荐技术栈创建项目时报告的问题。 编码愉快!
**需求 1** 计算器应该包含一个具有 `id="equals"` 属性的可以点击的元素,元素的文本内容为 `=`(等于符号)。

View File

@ -10,9 +10,9 @@ dashedName: build-a-markdown-previewer
**目标:** 在 [CodePen.io](https://codepen.io) 上实现一个功能类似 <https://codepen.io/freeCodeCamp/full/GrZVVO> 的 App。
在满足以下[需求](https://en.wikipedia.org/wiki/User_story)并能通过所有测试的前提下, 你可以根据自己的喜好来美化 app
在满足以下 [需求](https://en.wikipedia.org/wiki/User_story) 并能通过所有测试的前提下, 赋予它你自己的个人风格
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复使用推荐技术栈遇到的反馈问题。 编码愉快!
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战;不推荐使用前面没有提到的技术,否则风险自负。 不推荐使用前面没有提到的技术,否则风险自。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复你在使用推荐技术栈创建项目时报告的问题。 编码愉快!
**需求 1** 应该能看到一个具有 `id="editor"` 属性的 `textarea` 元素。

View File

@ -10,9 +10,9 @@ dashedName: build-a-random-quote-machine
**目标:** 在 [CodePen.io](https://codepen.io) 上实现一个功能类似 <https://codepen.io/freeCodeCamp/full/qRZeGZ> 的 App。
在满足以下[需求](https://en.wikipedia.org/wiki/User_story)并能通过所有测试的前提下, 可以根据自己的喜好来美化 app
在满足以下 [需求](https://en.wikipedia.org/wiki/User_story) 并能通过所有测试的前提下, 赋予它你自己的个人风格
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战。 不推荐使用前面没有提到的技术,否则风险自担。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复使用推荐技术栈遇到的反馈问题。 编码愉快!
可以使用 HTML、JavaScript、CSS、Bootstrap、SASS、React、Redux、jQuery 来完成这个挑战。 但鉴于这个章节的学习内容与前端框架相关,推荐使用一款前端框架(比如 React来完成这个挑战;不推荐使用前面没有提到的技术,否则风险自负。 不推荐使用前面没有提到的技术,否则风险自担。 我们有计划新增其他前端框架课程,例如 Angular 和 Vue不过目前还没有这些内容。 我们会接受并尝试修复你在使用推荐技术栈创建项目时报告的问题。 编码愉快!
**需求 1** 应该能看到一个具有 `id="quote-box"` 属性的包裹元素。

View File

@ -39,7 +39,7 @@ assert(
assert(code.match(/\:even/g));
```
应该仅用 jQuery 给元素添加 class。
应该仅用 jQuery 给标签添加 class。
```js
assert(

View File

@ -33,7 +33,7 @@ $("button").addClass("animated bounce");
assert($('button').hasClass('animated') && $('button').hasClass('bounce'));
```
应该仅用 jQuery 给元素添加 class。
应该仅用 jQuery 给标签添加 class。
```js
assert(!code.match(/class.*animated/g));

View File

@ -18,7 +18,7 @@ dashedName: connect-redux-to-the-messages-app
# --hints--
`AppWrapper` 应渲染该页面上。
`AppWrapper`渲染该页面上。
```js
assert(
@ -29,7 +29,7 @@ assert(
);
```
`Presentational` 组件应该渲染到页面上
`Presentational` 应该渲染到页面上.
```js
assert(
@ -70,7 +70,7 @@ assert(
);
```
`Presentational` 组件应接收创建 action 的函数 `submitMessage` 属性。
`Presentational` 组件应接收创建 action 的函数 `submitMessage` 属性。
```js
assert(

View File

@ -31,7 +31,6 @@ JSX 元素使用 `style` 属性,但是鉴于 JSX 的编译方式,不能将
在代码编辑器中给 `div` 添加一个 `style` 属性,将文本颜色设置为红色,字体大小设置为 `72px`
请注意,可以选择将字体大小设置为数字,省略单位 `px`,或者将其写为 `72px`
# --hints--
组件应该渲染一个 `div` 元素。

View File

@ -8,7 +8,7 @@ dashedName: render-conditionally-from-props
# --description--
到目前为止,已经看到如何使用 `if/else``&&` 以及三元运算符(`condition ? expressionIfTrue : expressionIfFalse`在不同条件下运行不同的代码。 然而,还有一个重要的话题需要讨论,将这些概念中的任何一个或所有概念与另一个强大的 React 功能 props 结合起来。 使用 props 有条件地渲染代码在 React 开发人员中很常见——也就是说:他们使用给定 prop 的值来自动决定渲染什么。
到目前为止,已经看到如何使用 `if/else``&&`三元运算符(`condition ? expressionIfTrue : expressionIfFalse`对渲染什么和何时渲染做出有条件的判定。 然而,还有一个重要的话题需要讨论,将这些概念中的任何一个或所有概念与另一个强大的 React 功能 props 结合起来。 使用 props 有条件地渲染代码在 React 开发人员中很常见——也就是说:他们使用给定 prop 的值来自动决定渲染什么。
在这个挑战中,将设置一个子组件来根据 props 做出渲染决定。 可以使用三元运算符,但是可以看到过去几个挑战中涵盖的其他几个概念在这种情况下可能同样有用。

View File

@ -16,7 +16,7 @@ ReactDOM 提供了一个简单的方法来将 React 元素呈现给 DOM如下
# --instructions--
代码编辑器有一个简单的 JSX 组件。 使用 `ReactDOM.render()` 方法将该组件渲染到页面。 可以将定义好的 JSX 元素直接作为第一个参数传入,然后使用 `document.getElementById()` 来选择要渲染到的 DOM 节点, 在这个挑战中,请渲染到 `id='challenge-node'` `div` 中。 确保没有修改 `JSX` 常量。
代码编辑器有一个简单的 JSX 组件。 使用 `ReactDOM.render()` 方法将该组件渲染到页面。 可以将定义好的 JSX 元素直接作为第一个参数传入,然后使用 `document.getElementById()` 来选择要渲染到的 DOM 节点, 在这个挑战中,请渲染到 `id='challenge-node'``div` 中。 确保没有修改 `JSX` 常量。
# --hints--

View File

@ -18,7 +18,7 @@ MyComponent 的 state 中包含一个 `boolean`(布尔值),用于跟踪是
# --hints--
`MyComponent` 应该存在并渲染。
`MyComponent` 应该存在并渲染。
```js
assert(
@ -29,7 +29,7 @@ assert(
);
```
`display` 被设置为 `true` 时,`div``button``h1` 标签应该渲染。
`display` 被设置为 `true` 时,`div``button``h1` 标签应该渲染。
```js
async () => {
@ -50,7 +50,7 @@ async () => {
};
```
`display` 被设置为 `false` 时,只有 `div``button` 应该渲染。
`display` 被设置为 `false` 时,只有 `div``button` 应该渲染。
```js
async () => {

View File

@ -1,6 +1,6 @@
---
id: 5a24c314108439a4d4036185
title: Use && for a More Concise Conditional
title: 使用 && 获得更简洁的条件
challengeType: 6
forumTopicId: 301413
dashedName: use--for-a-more-concise-conditional
@ -8,7 +8,7 @@ dashedName: use--for-a-more-concise-conditional
# --description--
`if/else` 语句在上一次挑战中是有效的,但是有一种更简洁的方法可以达到同样的结果。 假设正在跟踪组件中的几个条件,并且希望根据这些条件中的每一个来渲染不同的元素。 如果你写了很多 `else if` 语句来返回稍微不同的 UI你可能会写很多重复代码这就留下了出错的空间。 相反,你可以使用 `&&` 逻辑运算符以更简洁的方式执行条件逻辑。 这是完全可行的,因为你希望检查条件是否为 `true`。如果是,则返回一些标记。 这里有一个例子
`if/else` 语句在上一次挑战中是有效的,但是有一种更简洁的方法可以达到同样的结果。 假设正在跟踪组件中的几个条件,并且希望根据这些条件中的每一个来渲染不同的元素。 如果你写了很多 `else if` 语句来返回稍微不同的 UI你可能会写很多重复代码这就留下了出错的空间。 相反,你可以使用 `&&` 逻辑运算符以更简洁的方式执行条件逻辑。 这是完全可行的,因为你希望检查条件是否为 `true`。如果是,则返回一些标记。 下面是一个示例
```jsx
{condition && <p>markup</p>}

View File

@ -8,7 +8,7 @@ dashedName: use-advanced-javascript-in-react-render-method
# --description--
在之前的挑战中,学习了如何使用大括号 `{ }` 将 JavaScript 代码插入到 JSX 代码中,用于访问 props、传递 props、访问 state、在代码中插入注释以及最近学习的定制组件样式等任务。 这些都是将 JavaScript 放在 JSX 中的常见用例,但是在 React 组件中使用 JavaScript 代码还有其他方式。
在之前的挑战中,学习了如何使用大括号 `{ }` 将 JavaScript 代码插入到 JSX 代码中,用于访问 props、传递 props、访问 state、在代码中插入注释以及最近学习的定制组件样式等任务。 这些都是将 JavaScript 放在 JSX 中的常见用例,但是在 React 组件中使用 JavaScript 代码还有其他方式。
`render` 方法中编写 JavaScript可以把 JavaScript 直接放在 `return` 语句之前,而***不必***将其插入大括号中。 这是因为它还不在 JSX 代码中。 如果之后想在 `return` 语句中的 JSX 代码*里面*使用变量时,可以将变量名放在大括号中。

View File

@ -8,7 +8,7 @@ dashedName: copy-an-object-with-object-assign
# --description--
最后几个挑战适用于数组,但是当状态是 `object` 时,有一些方法可以实现状态不变性。 处理对象的一个常用的方法是 `Object.assign()``Object.assign()` 获取目标对象和源对象,并将源对象中的属性映射到目标对象。 任何匹配的属性都会被源对象中的属性覆盖。 通常用于通过传递一个空对象作为第一个参数,然后是要用复制的对象来制作对象的浅表副本。 是一个例
最后几个挑战适用于数组,但是当状态是 `object` 时,有一些方法可以实现状态不变性。 处理对象的一个常用的方法是 `Object.assign()``Object.assign()` 获取目标对象和源对象,并将源对象中的属性映射到目标对象。 任何匹配的属性都会被源对象中的属性覆盖。 通常用于通过传递一个空对象作为第一个参数,然后是要用复制的对象来制作对象的浅表副本。 下面是一个例:
```js
const newObject = Object.assign({}, obj1, obj2);

View File

@ -8,7 +8,7 @@ dashedName: define-an-action-creator
# --description--
创建 action 后要将 action 发送到 Redux store以便它可以更新其状态。 在 Redux 中,可以定义动作创建器来完成此任务, action creator 只是一个返回动作的 JavaScript 函数 换句话说action creator 创建表示动作事件的对象。
创建 action 后要将 action 发送到 Redux store以便它可以更新其状态。 在 Redux 中,可以定义动作创建器来完成此任务, action creator 只是一个返回动作的 JavaScript 函数 换句话说action creator 创建表示动作事件的对象。
# --instructions--

View File

@ -16,7 +16,7 @@ dashedName: use-each-to-map-over-items-in-a-list
}
```
map 的语法略有不同。 这是一个例
map 的语法略有不同。 这是一个例:
```scss
$colors: (color1: blue, color2: red, color3: green);

View File

@ -1,6 +1,6 @@
---
id: 5a8b073d06fa14fcfde687aa
title: Exercise 追踪器
title: 运动追踪器
challengeType: 4
forumTopicId: 301505
dashedName: exercise-tracker
@ -8,13 +8,55 @@ dashedName: exercise-tracker
# --description--
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似: <https://exercise-tracker.freecodecamp.rocks/>可以采用下面的一种方式完成这个挑战
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似: <https://exercise-tracker.freecodecamp.rocks/>在这个项目中,你将使用以下方法之一编写你的代码
- 克隆 [GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/) 并在本地完成你的项目。
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker)来完成你的项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--
你的答案应该有以下结构。
运动:
```js
{
username: "fcc_test"
description: "test",
duration: 60,
date: "Mon Jan 01 1990",
_id: "5fb5853f734231456ccb3b05"
}
```
用户:
```js
{
username: "fcc_test",
_id: "5fb5853f734231456ccb3b05"
}
```
日志:
```js
{
username: "fcc_test",
count: 1,
_id: "5fb5853f734231456ccb3b05",
log: [{
description: "test",
duration: 60,
date: "Mon Jan 01 1990",
}]
}
```
**提示:** 对于 `date` 属性,`Date` API 的 `toDateString` 方法可以用于实现预期的输出。
# --hints--
@ -29,7 +71,24 @@ dashedName: exercise-tracker
};
```
可以将表单里的 `username` 通过 `POST` 请求发送到 `/api/users`,以创建一个新的用户。 返回的响应内容是一个带有 `username``_id` 的对象
可以将表单里的 `username` 通过 `POST` 请求发送到 `/api/users`,以创建一个新的用户。
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
});
assert.isTrue(res.ok);
if(!res.ok) {
throw new Error(`${res.status} ${res.statusText}`)
};
};
```
`POST /api/users` 带有表单数据 `username` 对请求,返回的响应将是一个具有 `username``_id` 属性的对象.
```js
async (getUserInput) => {
@ -49,24 +108,89 @@ async (getUserInput) => {
};
```
可以发送 `GET` 请求到 `/api/users`,以获取一个所有用户的数组, 数组里的每个元素都是一个包含 `username``_id` 的用户对象
可以 `/api/users` 发出 `GET` 请求以获取所有用户的列表
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users');
assert.isTrue(res.ok);
if(!res.ok) {
throw new Error(`${res.status} ${res.statusText}`)
};
};
```
`/api/users``GET` 请求返回一个数组。
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users');
if(res.ok){
const users = await res.json();
assert.isArray(users);
} else {
throw new Error(`${res.status} ${res.statusText}`);
};
};
```
`GET /api/users` 返回的数组中的每个元素都是一个对象字面量,包含用户的 `username``_id`
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users');
if(res.ok){
const users = await res.json();
const user = users[0];
assert.exists(user);
assert.exists(user.username);
assert.exists(user._id);
assert.isString(user.username);
assert.isString(user._id);
} else {
throw new Error(`${res.status} ${res.statusText}`);
};
};
```
你能用表单里的 `description``duration``date`(可选)发送 `POST` 请求到 `/api/users/:_id/exercises`。 如果没有传入 date默认采用当前日期。
```js
async (getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users');
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
});
if (res.ok) {
const data = await res.json();
assert.isArray(data);
assert.isString(data[0].username);
assert.isString(data[0]._id);
const { _id, username } = await res.json();
const expected = {
username,
description: 'test',
duration: 60,
_id,
date: 'Mon Jan 01 1990'
};
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-01`
});
assert.isTrue(addRes.ok);
if(!addRes.ok) {
throw new Error(`${addRes.status} ${addRes.statusText}`)
};
} else {
throw new Error(`${res.status} ${res.statusText}`);
}
};
```
你能用表单里的 `description``duration``date`(可选)发送 `POST` 请求到 `/api/users/:_id/exercises`。 如果没有传入 date默认采用当前日期。 响应内容是包含 exercise 表单内容的 user 对象。
`POST /api/users/:_id/exercises` 返回的响应将是添加了运动字段的用户对象。
```js
async (getUserInput) => {
@ -93,6 +217,9 @@ async (getUserInput) => {
if (addRes.ok) {
const actual = await addRes.json();
assert.deepEqual(actual, expected);
assert.isString(actual.description);
assert.isNumber(actual.duration);
assert.isString(actual.date);
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
}
@ -102,7 +229,7 @@ async (getUserInput) => {
};
```
可以发送 `GET` 请求到 `/api/users/:_id/logs`,以获取任何用户的完整 exercise 日志。 响应内容是一个 user 对象,它带有一个 `log` 属性,该属性的值是所有被添加的 exercises 表单记录组成的数组, 每一个 log 数组里的元素应该是一个含有 `description``duration``date` 等属性的对象。
可以发送 `GET` 请求到 `/api/users/:_id/logs`,以获取任何用户的完整 exercise 日志。
```js
async (getUserInput) => {
@ -128,13 +255,10 @@ async (getUserInput) => {
});
if (addRes.ok) {
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if (logRes.ok) {
const { log } = await logRes.json();
assert.isArray(log);
assert.equal(1, log.length);
} else {
throw new Error(`${logRes.status} ${logRes.statusText}`);
}
assert.isTrue(logRes.ok);
if(!logRes.ok) {
throw new Error(`${logRes.status} ${logRes.statusText}`)
};
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
}
@ -144,7 +268,7 @@ async (getUserInput) => {
};
```
用户日志请求`/api/users/:_id/logs`返回一个带有 `count` 属性的对象,该属性反映 exercises 表单的成功提交次数(译者注:即 log 属性元素的个数)
用户日志请求 `GET /api/users/:_id/logs` 返回一个用户对象,该对象具有一个 `count` 属性,表示属于该用户的运动次数
```js
async (getUserInput) => {
@ -185,7 +309,239 @@ async (getUserInput) => {
};
```
可以把 `from``to``limit` 参数添加到一个 `/api/users/:_id/logs` 请求,以查询该用户的部分 exercise 表单提交记录, `from``to``yyyy-mm-dd` 形式的日期, `limit` 是希望返回的 log
`/api/users/:id/logs` `GET` 请求将返回用户对象,其中包含添加的所有练习的 `log`
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
})
if(res.ok){
const {_id, username} = await res.json();
const expected = {
username,
description: 'test',
duration: 60,
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `description=${expected.description}&duration=${expected.duration}`
});
if(addRes.ok){
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if(logRes.ok) {
const {log} = await logRes.json();
assert.isArray(log);
assert.equal(1, log.length);
} else {
throw new Error(`${logRes.status} ${logRes.statusText}`);
}
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
};
} else {
throw new Error(`${res.status} ${res.statusText}`)
};
};
```
`GET /api/users/:id/logs` 返回的 `log` 数组中的每一项都是一个应该具有 `description` 的对象, `duration``date` 属性。
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + `/api/users`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `username=fcc_test_${Date.now()}`.substr(0, 29)
});
if(res.ok) {
const {_id, username} = await res.json();
const expected = {
username,
description: 'test',
duration: 60,
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `description=${expected.description}&duration=${expected.duration}`
});
if(addRes.ok) {
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if(logRes.ok) {
const {log} = await logRes.json();
const exercise = log[0];
assert.exists(exercise);
assert.exists(exercise.description);
assert.exists(exercise.duration);
assert.exists(exercise.date);
} else {
throw new Error(`${logRes.status} ${logRes.statusText}`);
};
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
};
} else {
throw new Error(`${res.status} ${res.statusText}`)
};
};
```
`GET /api/users/:id/logs` 返回的 `log` 数组中任何对象的 `description` 属性都应该是一个字符串。
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users/', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `username=fcc_test_${Date.now()}`.substr(0,29)
});
if(res.ok) {
const {_id, username} = await res.json();
const expected = {
username,
description: 'test',
duration: 60,
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `description=${expected.description}&duration=${expected.duration}`
});
if(addRes.ok) {
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if(logRes.ok){
const {log} = await logRes.json();
const exercise = log[0];
assert.isString(exercise.description);
assert.equal(exercise.description, expected.description);
} else {
throw new Error(`${logRes.status} ${logRes.statusText}`);
}
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
};
} else {
throw new Error(`${res.status} ${res.statusText}`);
};
};
```
`GET /api/users/:id/logs` 返回的 `log` 数组中任何对象的 `duration` 属性都应该是一个数字。
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users/', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `username=fcc_test_${Date.now()}`.substr(0,29)
});
if(res.ok) {
const {_id, username} = await res.json();
const expected = {
username,
description: 'test',
duration: 60,
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `description=${expected.description}&duration=${expected.duration}`
});
if(addRes.ok) {
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if(logRes.ok){
const {log} = await logRes.json();
const exercise = log[0];
assert.isNumber(exercise.duration);
assert.equal(exercise.duration, expected.duration);
} else {
throw new Error(`${logRes.status} ${logRes.statusText}`);
}
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
};
} else {
throw new Error(`${res.status} ${res.statusText}`);
};
};
```
`GET /api/users/:id/logs` 返回的 `log` 数组中任何对象的 `date` 属性应该是一个字符串。 使用 `Date` API 的 `dateString` 格式。
```js
async(getUserInput) => {
const url = getUserInput('url');
const res = await fetch(url + '/api/users/', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `username=fcc_test_${Date.now()}`.substr(0,29)
});
if(res.ok) {
const {_id, username} = await res.json();
const expected = {
username,
description: 'test',
duration: 60,
_id,
date: new Date().toDateString()
};
const addRes = await fetch(url + `/api/users/${_id}/exercises`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `description=${expected.description}&duration=${expected.duration}`
});
if(addRes.ok) {
const logRes = await fetch(url + `/api/users/${_id}/logs`);
if(logRes.ok){
const {log} = await logRes.json();
const exercise = log[0];
assert.isString(exercise.date);
assert.equal(exercise.date, expected.date);
} else {
throw new Error(`${logRes.status} ${logRes.statusText}`);
}
} else {
throw new Error(`${addRes.status} ${addRes.statusText}`);
};
} else {
throw new Error(`${res.status} ${res.statusText}`);
};
};
```
你可以将 `from``to``limit` 参数添加到 `GET /api/users/:_id/logs` 请求检索任何用户的部分日志。 `from``to``yyyy-mm-dd` 形式的日期, `limit` 是希望返回的 log 数量。
```js
async (getUserInput) => {

View File

@ -8,13 +8,13 @@ dashedName: file-metadata-microservice
# --description--
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://file-metadata-microservice.freecodecamp.rocks/>可以采用下面的一种方式完成这个挑战
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://file-metadata-microservice.freecodecamp.rocks/>在这个项目中,你将使用以下方法之一编写你的代码
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) 并在本地完成项目。
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata)来完成你的项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--

View File

@ -8,13 +8,13 @@ dashedName: request-header-parser-microservice
# --description--
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://request-header-parser-microservice.freecodecamp.rocks/>可以采用下面的一种方式完成这个挑战
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://request-header-parser-microservice.freecodecamp.rocks/>在这个项目中,你将使用以下方法之一编写你的代码
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-headerparser/) 并在本地完成项目。
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser)来完成你的项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --hints--

View File

@ -8,13 +8,13 @@ dashedName: timestamp-microservice
# --description--
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://timestamp-microservice.freecodecamp.rocks/>可以采用下面的任意一种方式完成这个挑战
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://timestamp-microservice.freecodecamp.rocks/>在这个项目中,你将使用以下方法之一编写你的代码
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) 并在本地完成项目。
- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-project-timestamp/) 并在本地完成项目。
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp)来完成你的项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --hints--

View File

@ -8,13 +8,13 @@ dashedName: url-shortener-microservice
# --description--
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://url-shortener-microservice.freecodecamp.rocks/>可以采用下面的任意一种方式完成这个挑战
构建一个 JavaScript 的全栈应用,在功能上与这个应用相似:<https://url-shortener-microservice.freecodecamp.rocks/>在这个项目中,你将使用以下方法之一编写你的代码
- 克隆 [this GitHub repo](https://github.com/freeCodeCamp/boilerplate-project-filemetadata/) 并在本地完成项目。
- 使用[我们的 Replit 初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener)来完成你的项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--

View File

@ -18,11 +18,11 @@ dashedName: get-data-from-post-requests
POST有时候是 PUT- 使用请求发送信息,以创建新资源;
GET- 读取不用修改的已存在的资源;
GET - 读取不用修改的已存在的资源;
PUT 或者 PATCH有时候是 POST- 发送数据,以更新资源;
DELETE=> 删除一个资源。
DELETE => 删除一个资源。
还有其他两种方法常用于与服务进行交互。 除了 GET 之外,上面列出的所有方法都可以负载数据(即数据都能放到消息正文中), 这些方法也可以使用 body-parser 中间件。

View File

@ -10,7 +10,7 @@ dashedName: implement-a-root-level-request-logger-middleware
前面我们介绍了 `express.static()` 中间件函数, 现在是时候更详细地了解什么是中间件了。 中间件函数是一个接收 3 个参数的函数,这 3 个参数分别是:请求对象、响应对象和在应用的请求-响应循环中的下一个函数。 中间件函数执行一些可能对应用程序产生一些效果的代码,通常还会在请求对象或者响应对象里添加一些信息, 它们也可以在满足某些条件时通过发送响应来结束循环, 如果在它们完成时没有发送响应,那么就会开始执行堆栈中的下一个函数, `next()` 将触发调用第 3 个参数。
看看下面的例子
请看以下示例
```js
function(req, res, next) {
@ -25,7 +25,7 @@ function(req, res, next) {
构建一个简单的日志记录器。 对于每个请求,它应该在控制台中打印一个采用以下格式的字符串:`method path - ip` 例如:`GET /json - ::ffff:127.0.0.1`。 注意 `method``path` 之间有一个空格,并且 `path``ip` 中间的破折号的两边都有空格。 可以使用 `req.method``req.path``req.ip` 从请求对象中分别获取请求方法http 动词)、路由相对路径和请求者的 ip 信息。 当你完成时,记得要调用 `next()`,否则服务器将一直处于挂起状态。 请确保“Logs”是打开的观察一下当一些请求到达时会发生什么事情。
**注意:**Express 按照函数在代码中出现的顺序来执行, 中间件也是如此。 如果你想让中间件函数适用于所有路由,那么应该在路由之前配置好中间件。
**注意:** Express 按照函数在代码中出现的顺序来执行, 中间件也是如此。 如果你想让中间件函数适用于所有路由,那么应该在路由之前配置好中间件。
# --hints--

View File

@ -8,13 +8,13 @@ dashedName: meet-the-node-console
# --description--
可以采用下面的任意一种方式完成这些挑战:
可以采用下面的任意一种编写代码的方式完成这些挑战:
- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-express/) 并在本地完成项目。
- 使用[我们的 Repl.it 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-express)来完成项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link`
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL
在开发过程中,能够随时看到代码的运行结果是非常重要的。

View File

@ -8,7 +8,7 @@ dashedName: add-a-version-to-your-package-json
# --description--
`version` 是 package.json 文件中必填字段之一, 这个字段描述了当前项目的版本,
`version` 是 package.json 文件中必填字段之一, 这个字段描述了当前项目的版本, 下面是一个示例
```json
"version": "1.2.0",

View File

@ -8,7 +8,7 @@ dashedName: add-keywords-to-your-package-json
# --description--
`keywords` 字段中可以使用相关的关键字描述项目。 例
`keywords` 字段中可以使用相关的关键字描述项目。 下面是一个示例:
```json
"keywords": [ "descriptive", "related", "words" ],

View File

@ -28,7 +28,7 @@ dashedName: expand-your-project-with-external-packages-from-npm
# --hints--
“dependencies”应该包含“moment”
“dependencies”字段应该包含“moment”
```js
(getUserInput) =>

View File

@ -8,13 +8,13 @@ dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-packa
# --description--
可以采用下面的任意一种方式完成这些挑战:
可以采用下面的任意一种编写代码的方式完成这些挑战:
- 克隆 [GitHub repo](https://github.com/freeCodeCamp/boilerplate-npm/) 并在本地完成项目。
- 使用[我们的 Replit 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-npm)来完成项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link` 。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
`package.json` 文件是所有 Node.js 项目和 npm 包的枢纽, 和 HTML 文档中的 &lt;head> 区域用来描述网页的配置信息(元数据)一样,它存储项目的相关信息。 它由单个 JSON 对象组成,并以键值对的形式存储项目信息, 且至少包含两个必填字段“name”和“version”——但是最好提供有关项目的其他信息这将对用户或者维护者有所帮助。

View File

@ -22,7 +22,7 @@ dashedName: use-the-caret-character-to-use-the-latest-minor-version-of-a-depende
在依赖项中,使用脱字符(`^`)为 moment 的版本添加前缀,允许 npm 更新依赖包到任意新的次版本。
**注意:**原来的版本号不用更改。
**注意:** 原来的版本号不用更改。
# --hints--

View File

@ -26,7 +26,7 @@ dashedName: use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-
# --hints--
“dependencies”应包含“moment”
“dependencies”字段中应包含“moment”
```js
(getUserInput) =>

View File

@ -8,7 +8,7 @@ dashedName: create-a-model
# --description--
**C**RUD 第一小节——CREATE
**C** RUD 第一小节——CREATE
首先,我们需要一个 Schema 每一个 Schema 都对应一个 MongoDB 的 collection 并且在相应的 collection 里定义 documents 的“样子”。 Schema 用于组成模型Model 我们甚至可以通过嵌套 Schema 来创建复杂的模型。目前我们先从简。 我们可以根据模型创建实例,模型实例化后的对象称为 documents。

View File

@ -8,13 +8,13 @@ dashedName: install-and-set-up-mongoose
# --description--
可以采用下面的任意一种方式完成这些挑战:
可以采用下面的任意一种编写代码的方式完成这些挑战:
- 克隆 [GitHub repo](https://github.com/freeCodeCamp/boilerplate-mongomongoose/) 并在本地完成项目。
- 克隆 [这个 GitHub 仓库](https://github.com/freeCodeCamp/boilerplate-mongomongoose/) 并在本地完成项目。
- 使用[我们的 Replit 上的初始化项目](https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose)来完成项目。
- 使用你选择的网站生成器来完成项目 并确保包含我们 GitHub 仓库的所有文件。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 `Solution Link`
完成本项目,请一个正常运行的 demo(项目演示)托管在可以公开访问的平台。 然后 `Solution Link` 字段中提交它的 URL
在这个挑战中,你将建立一个 MongoDB Atlas 数据库并导入连接到它所需的软件包。
@ -22,7 +22,7 @@ dashedName: install-and-set-up-mongoose
# --instructions--
`mongodb``mongoose` 添加到项目的 `package.json` 文件中。 然后,在 `myApp.js` 文件中请求 `mongoose`。 创建一个 `.env` 文件,给它添加一个 `MONGO_URI` 变量。 变量的值为你的 MongoDB Atlas 数据库 URI。 应用单引号或双引号包裹 URI。请记住环境变量 `=` 两边不能有空格。 例如,`MONGO_URI='VALUE'`。 完成后,使用下面的代码来连接数据库。
`mongodb@~3.6.0``mongoose@~5.4.0` 添加到项目的 `package.json` 中。 然后,在 `myApp.js` 文件中请求 `mongoose`。 创建一个 `.env` 文件,给它添加一个 `MONGO_URI` 变量。 变量的值为你的 MongoDB Atlas 数据库 URI。 应用单引号或双引号包裹 URI。请记住环境变量 `=` 两边不能有空格。 例如,`MONGO_URI='VALUE'`。 完成后,使用下面的代码来连接数据库。
```js
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });

View File

@ -19,7 +19,7 @@ dashedName: parsing-html-and-saving-data
## --text--
为了解析 HTML 文本和提取表格,`.read_html()` 位于哪个 Python 的库
哪个 Python 库有 `.read_html()` 方法,我们可以用于解析 HTML 文档和提取表格
## --answers--

View File

@ -1,6 +1,6 @@
---
id: 587d825a367417b2b2512c89
title: Implement Quick Sort
title: 实现快速排序
challengeType: 1
forumTopicId: 301615
dashedName: implement-quick-sort
@ -8,21 +8,21 @@ dashedName: implement-quick-sort
# --description--
Here we will move on to an intermediate sorting algorithm: quick sort. Quick sort is an efficient, recursive divide-and-conquer approach to sorting an array. In this method, a pivot value is chosen in the original array. The array is then partitioned into two subarrays of values less than and greater than the pivot value. We then combine the result of recursively calling the quick sort algorithm on both sub-arrays. This continues until the base case of an empty or single-item array is reached, which we return. The unwinding of the recursive calls return us the sorted array.
在这里,我们将继续讨论中间排序算法:快速排序。 快速排序是对数组进行排序的一种有效的,递归的分而治之的方法。 在此方法中,在原始数组中选择一个枢轴值。 然后将该数组分成两个小于和大于数值的子数组。 然后,我们在两个子阵列上结合递归调用快速排序算法的结果。 这一直持续到达到空或单项数组的基本情况,我们返回。 递归调用的展开将返回已排序的数组。
Quick sort is a very efficient sorting method, providing *O(nlog(n))* performance on average. It is also relatively easy to implement. These attributes make it a popular and useful sorting method.
快速排序是一种非常有效的排序方法,平均提供 *O(nlog(n))* 的性能。 它也相对容易实现。 这些属性使其成为一种流行且有用的排序方法。
**Instructions:** Write a function `quickSort` which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest. While the choice of the pivot value is important, any pivot will do for our purposes here. For simplicity, the first or last element could be used.
**说明:** 编写一个函数 `quickSort`,它将整数数组作为输入,并按从最小到最大的排序顺序返回这些整数的数组。 虽然枢轴值的选择很重要,但任何枢轴都可以满足我们的目的。 为简单起见,可以使用第一个或最后一个元素。
# --hints--
`quickSort` should be a function.
`quickSort` 应该是一个函数。
```js
assert(typeof quickSort == 'function');
```
`quickSort` should return a sorted array (least to greatest).
`quickSort` 应该返回一个排序的数组(从最小到最大)。
```js
assert(
@ -50,7 +50,7 @@ assert(
);
```
`quickSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` should return an array that is unchanged except for order.
`quickSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92])` 应该返回一个数组,除了顺序之外没有变化。
```js
assert.sameMembers(
@ -77,7 +77,7 @@ assert.sameMembers(
);
```
`quickSort` should not use the built-in `.sort()` method.
`quickSort` 不应使用内置的 `.sort()` 方法。
```js
assert(isBuiltInSortUsed());

View File

@ -1,6 +1,6 @@
---
id: a56138aff60341a09ed6c480
title: Inventory Update
title: 库存更新
challengeType: 5
forumTopicId: 16019
dashedName: inventory-update
@ -8,11 +8,11 @@ dashedName: inventory-update
# --description--
Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in `arr1`). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical order by item.
将存储在二维数组中的库存与新交货的二维数组进行比较和更新。 更新当前现有库存物料数量(在 `arr1`)。 如果找不到商品,请将新商品和数量添加到库存数组中。 返回的库存数组应按项目的字母顺序排列。
# --hints--
The function `updateInventory` should return an array.
函数 `updateInventory` 应该返回一个数组。
```js
assert.isArray(
@ -33,7 +33,7 @@ assert.isArray(
);
```
`updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]])` should return an array with a length of 6.
`updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]])` 应该返回一个长度为 6 的数组。
```js
assert.equal(
@ -55,7 +55,7 @@ assert.equal(
);
```
`updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]])` should return `[[88, "Bowling Ball"], [2, "Dirty Sock"], [3, "Hair Pin"], [3, "Half-Eaten Apple"], [5, "Microphone"], [7, "Toothpaste"]]`.
`updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]])` 应返回`[[88, "Bowling Ball"], [2, "Dirty Sock"], [3, "Hair Pin"], [3, "Half-Eaten Apple"], [5, "Microphone"], [7, "Toothpaste"]]`
```js
assert.deepEqual(
@ -84,7 +84,7 @@ assert.deepEqual(
);
```
`updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [])` should return `[[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]]`.
`updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [])`应该返回`[[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]]`
```js
assert.deepEqual(
@ -106,7 +106,7 @@ assert.deepEqual(
);
```
`updateInventory([], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]])` should return `[[67, "Bowling Ball"], [2, "Hair Pin"], [3, "Half-Eaten Apple"], [7, "Toothpaste"]]`.
`updateInventory([], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]])` 应该返回 `[[67, "Bowling Ball"], [2, "Hair Pin"], [3, "Half-Eaten Apple"], [7, "Toothpaste"]]`
```js
assert.deepEqual(
@ -128,7 +128,7 @@ assert.deepEqual(
);
```
`updateInventory([[0, "Bowling Ball"], [0, "Dirty Sock"], [0, "Hair Pin"], [0, "Microphone"]], [[1, "Hair Pin"], [1, "Half-Eaten Apple"], [1, "Bowling Ball"], [1, "Toothpaste"]])` should return `[[1, "Bowling Ball"], [0, "Dirty Sock"], [1, "Hair Pin"], [1, "Half-Eaten Apple"], [0, "Microphone"], [1, "Toothpaste"]]`.
`updateInventory([[0, "Bowling Ball"], [0, "Dirty Sock"], [0, "Hair Pin"], [0, "Microphone"]], [[1, "Hair Pin"], [1, "Half-Eaten Apple"], [1, "Bowling Ball"], [1, "Toothpaste"]])` 应返回 `[[1, "Bowling Ball"], [0, "Dirty Sock"], [1, "Hair Pin"], [1, "Half-Eaten Apple"], [0, "Microphone"], [1, "Toothpaste"]]`
```js
assert.deepEqual(

View File

@ -1,6 +1,6 @@
---
id: 5f1a4ef5d5d6b5ab580fc6ae
title: Celestial Bodies Database
title: 天体数据库
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.celestial-bodies-database

View File

@ -1,6 +1,6 @@
---
id: 602da0de22201c65d2a019f6
title: Learn Advanced Bash by Building a Kitty Ipsum Translator
title: 通过构建一个 Kitty Ipsum 翻译器来学习高级 Bash
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-advanced-bash-by-building-a-kitty-ipsum-translator

View File

@ -1,6 +1,6 @@
---
id: 5f5b969a05380d2179fe6e18
title: Learn Bash and SQL by Building a Bike Rental Shop
title: 通过构建自行车租赁店来学习 Bash SQL
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-bash-and-sql-by-building-a-bike-rental-shop

View File

@ -1,6 +1,6 @@
---
id: 5ea8adfab628f68d805bfc5e
title: Learn Bash by Building a Boilerplate
title: 通过构建模版学习 Bash
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/freeCodeCamp/.learn-bash-by-building-a-boilerplate

View File

@ -1,6 +1,6 @@
---
id: 5f5904ac738bc2fa9efecf5a
title: Learn Bash Scripting by Building Five Programs
title: 通过构建五个程序学习 Bash 脚本
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-bash-scripting-by-building-five-programs

View File

@ -1,6 +1,6 @@
---
id: 5fa323cdaf6a73463d590659
title: Learn Git by Building an SQL Reference Object
title: 通过构建 SQL 引用对象来学习 Git
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-git-by-building-an-sql-reference-object

View File

@ -1,6 +1,6 @@
---
id: 602da04222201c65d2a019f3
title: Learn GitHub by Building a List of Inspirational Quotes
title: 通过建立励志名言列表来学习 GitHub
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-github-by-building-a-list-of-inspirational-quotes

View File

@ -1,6 +1,6 @@
---
id: 5f32db63eb37f7e17323f459
title: Learn Nano by Building a Castle
title: 通过构建城堡来学习 Nano
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-nano-by-building-a-castle

View File

@ -1,6 +1,6 @@
---
id: 5f2c289f164c29556da632fd
title: Learn Relational Databases by Building a Mario Database
title: 通过构建 Mario 数据库来学习关系型数据库
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-relational-databases-by-building-a-mario-database

View File

@ -1,6 +1,6 @@
---
id: 602da0c222201c65d2a019f5
title: Learn SQL by Building a Student Database
title: 通过构建学生数据库学习 SQL
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.learn-sql-by-building-a-student-database

View File

@ -1,6 +1,6 @@
---
id: 602da04c22201c65d2a019f4
title: Number Guessing Game
title: 猜数字游戏
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.number-guessing-game

View File

@ -1,6 +1,6 @@
---
id: 602d9ff222201c65d2a019f2
title: Periodic Table Database
title: 元素周期表数据库
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.periodic-table-database

View File

@ -1,6 +1,6 @@
---
id: 5f87ac112ae598023a42df1a
title: Salon Appointment Scheduler
title: 沙龙日程安排程序
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.salon-appointment-scheduler

View File

@ -1,6 +1,6 @@
---
id: 5f9771307d4d22b9d2b75a94
title: World Cup Database
title: 世界杯数据库
challengeType: 12
helpCategory: Relational Databases
url: https://github.com/moT01/.world-cup-database