chore(i18n,learn): processed translations (#45084)
This commit is contained in:
@ -36,7 +36,7 @@ return "Yes";
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
請使用邏輯或運算符把兩個 `if` 語句合併爲一個語句,如果 `val` 不在 `10` 和 `20` 之間(包括 10 和 20),返回 `Outside`。 否則,返回 `Inside`。
|
請使用邏輯或運算符把兩個 `if` 語句合併爲一個語句,如果 `val` 不在 `10` 和 `20` 之間(包括不是 10 和 不是 20),返回 `Outside`。 否則,返回 `Inside`。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ dashedName: declare-javascript-variables
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
在計算機科學中,<dfn>數據</dfn>就是一切,它對於計算機意義重大。 JavaScript 提供七種不同的<dfn>數據類型</dfn>,它們是 `undefined`(未定義)、`null`(空)、`boolean`(布爾型)、`string`(字符串)、`symbol`、`number`(數字)、`bigint`(可以表示任意大的整數)和 `object`(對象)。
|
在計算機科學中,<dfn>數據</dfn>就是一切,它對於計算機意義重大。 JavaScript 提供八種不同的<dfn>數據類型</dfn>,它們是 `undefined`(未定義)、`null`(空)、`boolean`(布爾型)、`string`(字符串)、`symbol`、`number`(數字)、`bigint`(可以表示任意大的整數)和 `object`(對象)。
|
||||||
|
|
||||||
例如,計算機區分數字,例如 `12`,和由字符組成的字符串 `strings`,例如 `"12"`、`"dog"` 或 `"123 cats"`。 計算機可以對數字執行數學運算,但不能對字符串執行數學運算。
|
例如,計算機區分數字,例如 `12`,和由字符組成的字符串 `strings`,例如 `"12"`、`"dog"` 或 `"123 cats"`。 計算機可以對數字執行數學運算,但不能對字符串執行數學運算。
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ myFun();
|
|||||||
修改函數 `abTest` 當 `a` 或 `b` 小於 `0` 時,函數立即返回一個 `undefined` 並退出。
|
修改函數 `abTest` 當 `a` 或 `b` 小於 `0` 時,函數立即返回一個 `undefined` 並退出。
|
||||||
|
|
||||||
**提示**
|
**提示**
|
||||||
記住 [`undefined` 是一個關鍵字](/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables),而不是一個字符串。
|
記住 [`undefined` 是一個關鍵字](https://chinese.freecodecamp.org/news/how-to-install-arch-linux/#how-to-install-arch-linux),而不是一個字符串。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ return "Yes";
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
请使用逻辑或运算符把两个 `if` 语句合并为一个语句,如果 `val` 不在 `10` 和 `20` 之间(包括 10 和 20),返回 `Outside`。 否则,返回 `Inside`。
|
请使用逻辑或运算符把两个 `if` 语句合并为一个语句,如果 `val` 不在 `10` 和 `20` 之间(包括不是 10 和 不是 20),返回 `Outside`。 否则,返回 `Inside`。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ dashedName: declare-javascript-variables
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
在计算机科学中,<dfn>数据</dfn>就是一切,它对于计算机意义重大。 JavaScript 提供七种不同的<dfn>数据类型</dfn>,它们是 `undefined`(未定义)、`null`(空)、`boolean`(布尔型)、`string`(字符串)、`symbol`、`number`(数字)、`bigint`(可以表示任意大的整数)和 `object`(对象)。
|
在计算机科学中,<dfn>数据</dfn>就是一切,它对于计算机意义重大。 JavaScript 提供八种不同的<dfn>数据类型</dfn>,它们是 `undefined`(未定义)、`null`(空)、`boolean`(布尔型)、`string`(字符串)、`symbol`、`number`(数字)、`bigint`(可以表示任意大的整数)和 `object`(对象)。
|
||||||
|
|
||||||
例如,计算机区分数字,例如 `12`,和由字符组成的字符串 `strings`,例如 `"12"`、`"dog"` 或 `"123 cats"`。 计算机可以对数字执行数学运算,但不能对字符串执行数学运算。
|
例如,计算机区分数字,例如 `12`,和由字符组成的字符串 `strings`,例如 `"12"`、`"dog"` 或 `"123 cats"`。 计算机可以对数字执行数学运算,但不能对字符串执行数学运算。
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ myFun();
|
|||||||
修改函数 `abTest` 当 `a` 或 `b` 小于 `0` 时,函数立即返回一个 `undefined` 并退出。
|
修改函数 `abTest` 当 `a` 或 `b` 小于 `0` 时,函数立即返回一个 `undefined` 并退出。
|
||||||
|
|
||||||
**提示**
|
**提示**
|
||||||
记住 [`undefined` 是一个关键字](/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables),而不是一个字符串。
|
记住 [`undefined` 是一个关键字](https://chinese.freecodecamp.org/news/how-to-install-arch-linux/#how-to-install-arch-linux),而不是一个字符串。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ myTest();
|
|||||||
console.log(loc);
|
console.log(loc);
|
||||||
```
|
```
|
||||||
|
|
||||||
`myTest()` 関数の呼び出しでは、コンソールに文字列 `foo` が表示されます。 `console.log(loc)` の行はエラーをスローします。これは、関数の外側では `loc` が定義されていないためです。
|
`myTest()` 関数の呼び出しでは、コンソールに文字列 `foo` が表示されます。 The `console.log(loc)` line (outside of the `myTest` function) will throw an error, as `loc` is not defined outside of the function.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
|
@ -60,6 +60,12 @@ assert.isUndefined(addTogether(2, '3'));
|
|||||||
assert.isUndefined(addTogether(2)([3]));
|
assert.isUndefined(addTogether(2)([3]));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`addTogether("2", 3)` should return `undefined`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert.isUndefined(addTogether('2', 3));
|
||||||
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
|
|
||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,24 @@ assert.sameMembers(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`1` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` は、4 つの要素を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with `3`, `2`, `1`, and `0`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert.sameMembers(
|
||||||
|
(function () {
|
||||||
|
var graph = [
|
||||||
|
[0, 1, 0, 0],
|
||||||
|
[1, 0, 1, 0],
|
||||||
|
[0, 1, 0, 1],
|
||||||
|
[0, 0, 1, 0]
|
||||||
|
];
|
||||||
|
return dfs(graph, 3);
|
||||||
|
})(),
|
||||||
|
[3, 2, 1, 0]
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` with a start node of `1` should return an array with four elements.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -65,7 +82,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`3` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` は、`3` を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` with a start node of `3` should return an array with `3`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.sameMembers(
|
assert.sameMembers(
|
||||||
@ -82,7 +99,7 @@ assert.sameMembers(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`3` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` は、1 つの要素を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]]` with a start node of `3` should return an array with one element.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -98,7 +115,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`3` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]`は、`2` と `3` を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with `2` and `3`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.sameMembers(
|
assert.sameMembers(
|
||||||
@ -115,7 +132,7 @@ assert.sameMembers(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`3` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` は、2 つの要素を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `3` should return an array with two elements.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -131,7 +148,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`0` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` は、`0` と `1` を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `0` should return an array with `0` and `1`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.sameMembers(
|
assert.sameMembers(
|
||||||
@ -148,7 +165,7 @@ assert.sameMembers(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
`0` を開始ノードとする入力グラフ `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` は、2 つの要素を持つ配列を返す必要があります。
|
The input graph `[[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]` with a start node of `0` should return an array with two elements.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
@ -568,11 +568,11 @@ async (getUserInput) => {
|
|||||||
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
const addExerciseTwoRes = await fetch(url + `/api/users/${_id}/exercises`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-02`
|
body: `description=${expected.description}&duration=${expected.duration}&date=1990-01-03`
|
||||||
});
|
});
|
||||||
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
if (addExerciseRes.ok && addExerciseTwoRes.ok) {
|
||||||
const logRes = await fetch(
|
const logRes = await fetch(
|
||||||
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-03`
|
url + `/api/users/${_id}/logs?from=1989-12-31&to=1990-01-04`
|
||||||
);
|
);
|
||||||
if (logRes.ok) {
|
if (logRes.ok) {
|
||||||
const { log } = await logRes.json();
|
const { log } = await logRes.json();
|
||||||
@ -591,6 +591,16 @@ async (getUserInput) => {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
throw new Error(`${limitRes.status} ${limitRes.statusText}`);
|
||||||
}
|
}
|
||||||
|
const filterDateBeforeLimitRes = await fetch(
|
||||||
|
url + `/api/users/${_id}/logs?from=1990-01-02&to=1990-01-04&limit=1`
|
||||||
|
);
|
||||||
|
if (filterDateBeforeLimitRes.ok) {
|
||||||
|
const { log } = await filterDateBeforeLimitRes.json();
|
||||||
|
assert.isArray(log);
|
||||||
|
assert.equal(1, log.length);
|
||||||
|
} else {
|
||||||
|
throw new Error(`${filterDateBeforeLimitRes.status} ${filterDateBeforeLimitRes.statusText}`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${res.status} ${res.statusText}`);
|
throw new Error(`${res.status} ${res.statusText}`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user