chore(i18n,learn): processed translations (#41416)
* chore(i8n,learn): processed translations * Update curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
@ -12,7 +12,7 @@ dashedName: catch-arguments-passed-in-the-wrong-order-when-calling-a-function
|
||||
|
||||
# --instructions--
|
||||
|
||||
函数 `raiseToPower` 返回基数 (base) 的指数 (exponent) 次幂。 不幸的是,它没有被正确调用 — 修改代码,使`power`的值为 8。
|
||||
函数 `raiseToPower` 返回基数 (base) 的指数 (exponent) 次幂。 不幸的是,它没有被正确调用 — 修改代码,使 `power` 的值为 8。
|
||||
|
||||
# --hints--
|
||||
|
||||
|
@ -20,17 +20,17 @@ dashedName: visualize-data-with-a-bar-chart
|
||||
|
||||
**需求 #3:** 图表应该包含一个 `g` 元素作为 y 轴,并相应地具有`id="y-axis"` 属性。
|
||||
|
||||
**需求 #4:** 两个轴都应包含多个刻度标签,每个标签具有 `class="tick"` 属性
|
||||
**需求 #4:** 两个轴都应包含多个刻度标签,每个标签具有 `class="tick"` 属性。
|
||||
|
||||
**需求 #5:** 在图表里,每个数据点都应该有一个具有 `class="bar"` 属性的 `rect` 元素来展示数据。
|
||||
|
||||
**需求 #6:** 每个数据条应该具有包含日期的 `data-date` 属性以及包含 GDP 值的 `data-gdp` 属性。
|
||||
**需求 #6:** 每个数据条应该具有值为 `date` 的 `data-date` 属性以及值为 `GDP` 的 `data-gdp` 属性。
|
||||
|
||||
**需求 #7:** 数据条元素的 `data-date` 属性应与提供的数据的顺序相匹配。
|
||||
|
||||
**需求 #8:** 数据条元素的 `data-gdp` 属性应与提供的数据的顺序相匹配。
|
||||
|
||||
**需求 #9:** 每个数据条元素的高度应准确地表示其数据所对应的 GDP 值。
|
||||
**需求 #9:** 每个数据条元素的高度应准确地表示其数据所对应的 `GDP` 值。
|
||||
|
||||
**需求 #10:** `data-date` 属性和它对应的数据条元素应与 x 轴上的相应的值对齐。
|
||||
|
||||
@ -44,7 +44,7 @@ dashedName: visualize-data-with-a-bar-chart
|
||||
|
||||
你可以 fork [这个 CodePen pen 项目](https://codepen.io/freeCodeCamp/pen/MJjpwO)来构建你的项目。 或者你可以在任何你喜欢的环境中使用以下 CDN 链接来运行测试:`https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`.
|
||||
|
||||
一旦你完成了本项目并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
当你完成了本项目,并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
|
||||
# --solutions--
|
||||
|
||||
|
@ -22,11 +22,11 @@ dashedName: visualize-data-with-a-choropleth-map
|
||||
|
||||
**需求 #4:** 这些州县至少应该有 4 种不同的填充颜色。
|
||||
|
||||
**需求 #5:** 每个州县都应该具有 `data-fips` 和 `data-education` 属性,分别包含他们相应的 fips 值和教育值。
|
||||
**需求 #5:** 每个州县都应该具有 `data-fips` 和 `data-education` 属性,分别包含相应的值 `fips` 和 `education`。
|
||||
|
||||
**需求 #6:** 在等值区域图中,每一个提供的数据点都应该有一个对应的州县。
|
||||
|
||||
**需求 #7:** 各个州县应该具有与样本数据匹配的 fips 值和教育值。
|
||||
**需求 #7:** 各个州县应该具有与样本数据匹配的 `data-fips` 和 `data-education` 值。
|
||||
|
||||
**需求 #8:** 等值区域图包含一个具有 `id="legend"` 属性的图例。
|
||||
|
||||
@ -43,7 +43,7 @@ dashedName: visualize-data-with-a-choropleth-map
|
||||
|
||||
你可以 fork [这个 CodePen 项目](https://codepen.io/freeCodeCamp/pen/MJjpwO)来构建你的项目。 或者你可以在任何你喜欢的环境中使用以下 CDN 链接来运行测试:`https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`.
|
||||
|
||||
一旦你完成了本项目并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
当你完成了本项目,并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
|
||||
# --solutions--
|
||||
|
||||
|
@ -26,7 +26,7 @@ dashedName: visualize-data-with-a-heat-map
|
||||
|
||||
**需求 #6:** 这些单元格元素至少应该有 4 种不同的填充颜色。
|
||||
|
||||
**需求 #7:** 每个单元格元素都有这些属性 `data-month`,`data-year`,`data-temp`,包含了它们相应的月份、年份和温度值。
|
||||
**需求 #7:** 每个单元格都有这些属性:`data-month`、`data-year`、`data-temp`,具有相应的属性值 `month`、`year`、`temperature`。
|
||||
|
||||
**需求 #8:** 每个元素的 `data-month`、`data-year` 属性应该在数据范围内。
|
||||
|
||||
@ -52,7 +52,7 @@ dashedName: visualize-data-with-a-heat-map
|
||||
|
||||
你可以 fork [这个 CodePen 项目](https://codepen.io/freeCodeCamp/pen/MJjpwO)来构建你的项目。 或者你可以在任何你喜欢的环境中使用以下 CDN 链接来运行测试:`https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`.
|
||||
|
||||
一旦你完成了本项目并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
当你完成了本项目,并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
|
||||
# --solutions--
|
||||
|
||||
|
@ -22,9 +22,9 @@ dashedName: visualize-data-with-a-scatterplot-graph
|
||||
|
||||
**需求 #4:** 散点图包含一些点,每个点都有一个值为 `dot` 的 class 属性,它代表了被绘制的数据。
|
||||
|
||||
**需求 #5:** 每个点都应具有 `data-xvalue` 属性和 `data-yvalue` 属性,对应这个点的 x 和 y 值。
|
||||
**需求 #5:** 每个点都应具有 `data-xvalue` 属性和 `data-yvalue` 属性,具有相应的属性值 `x` 和 `y`。
|
||||
|
||||
**需求 #6:** 每个点的 `data-xvalue` 属性和 `data-yvalue` 属性应该在实际数据的范围内,并且数据格式应该正确无误。 对于 `data-xvalue` 属性,可以接受整数(全年)或 Date 对象进行测试评估。 对于 `data-yvalue` 属性(分钟),请使用 Date 对象。
|
||||
**需求 #6:** 每个点的 `data-xvalue` 属性和 `data-yvalue` 属性应该在实际数据的范围内,并且数据格式应该正确无误。 对于`data-xvalue` ,可以接受整数(全年)或 `Date` 对象进行测试评估。 对于 `data-yvalue`(分钟),应使用 `Date` 对象。
|
||||
|
||||
**需求 #7:** `data-xvalue` 属性和它对应的点应该和 x 轴上的点或值对齐。
|
||||
|
||||
@ -48,7 +48,7 @@ dashedName: visualize-data-with-a-scatterplot-graph
|
||||
|
||||
你可以 fork [这个 CodePen 项目](https://codepen.io/freeCodeCamp/pen/MJjpwO)来构建你的项目。 或者你可以在任何你喜欢的环境中使用以下 CDN 链接来运行测试:`https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`.
|
||||
|
||||
一旦你完成了本项目并且通过所有测试,请提交项目的 URL。
|
||||
当你完成了本项目,并且项目通过所有测试,请提交项目的 URL。
|
||||
|
||||
# --solutions--
|
||||
|
||||
|
@ -22,9 +22,9 @@ dashedName: visualize-data-with-a-treemap-diagram
|
||||
|
||||
**需求 #4:** 这些矩形块元素至少应该有 2 种不同的填充颜色。
|
||||
|
||||
**需求 #5:** 每一块矩形元素应该具有 `data-name`、`data-category`、以及`data-value` 这些属性,包含了它们相应的名称,分类,以及数值。
|
||||
**需求 #5:** 每一个矩形元素应该有 `data-name`、`data-category`、`data-value` 属性,具有相应的 `name`、`category`、`value` 属性值。
|
||||
|
||||
**需求 #6:** 每个矩形块的面积和它的 data-value 属性值相对应:data-value 值越大的矩形块面积越大。
|
||||
**需求 #6:** 每个矩形块的面积和它的 `data-value` 属性值相对应:`data-value` 值越大的矩形块面积越大。
|
||||
|
||||
**需求 #7:** 矩阵树图包含一个具有 `id="legend"` 属性的图例。
|
||||
|
||||
@ -44,7 +44,7 @@ dashedName: visualize-data-with-a-treemap-diagram
|
||||
|
||||
你可以 fork [这个 CodePen 项目](https://codepen.io/freeCodeCamp/pen/MJjpwO)来构建你的项目。 或者你可以在任何你喜欢的环境中使用以下 CDN 链接来运行测试:`https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js`.
|
||||
|
||||
一旦你完成了本项目并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
当你完成了本项目,并且该项目所有测试运行通过,请提交项目的 URL。
|
||||
|
||||
# --solutions--
|
||||
|
||||
|
@ -24,55 +24,55 @@ dashedName: add-a-tooltip-to-a-d3-element
|
||||
assert($('title').length == 9);
|
||||
```
|
||||
|
||||
第一个 `title` 元素的提示框文本应为 12。
|
||||
第一个 `title` 元素的提示框文本应为 `12`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(0).text() == '12');
|
||||
```
|
||||
|
||||
第二个 `title` 元素的提示框文本应为 31。
|
||||
第二个 `title` 元素的提示框文本应为 `31`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(1).text() == '31');
|
||||
```
|
||||
|
||||
第三个 `title` 元素的提示框文本应为 22。
|
||||
第三个 `title` 元素的提示框文本应为 `22`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(2).text() == '22');
|
||||
```
|
||||
|
||||
第四个 `title` 元素的提示框文本应为 17。
|
||||
第四个 `title` 元素的提示框文本应为 `17`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(3).text() == '17');
|
||||
```
|
||||
|
||||
第五个 `title` 元素的提示框文本应为 25。
|
||||
第五个 `title` 元素的提示框文本应为 `25`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(4).text() == '25');
|
||||
```
|
||||
|
||||
第六个 `title` 元素的提示框文本应为 18。
|
||||
第六个 `title` 元素的提示框文本应为 `18`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(5).text() == '18');
|
||||
```
|
||||
|
||||
第七个 `title` 元素的提示框文本应为 29。
|
||||
第七个 `title` 元素的提示框文本应为 `29`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(6).text() == '29');
|
||||
```
|
||||
|
||||
第八个 `title` 元素的提示框文本应为 14。
|
||||
第八个 `title` 元素的提示框文本应为 `14`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(7).text() == '14');
|
||||
```
|
||||
|
||||
第九个 `title` 元素的提示框文本应为 9。
|
||||
第九个 `title` 元素的提示框文本应为 `9`。
|
||||
|
||||
```js
|
||||
assert($('title').eq(8).text() == '9');
|
||||
|
@ -16,17 +16,17 @@ dashedName: add-labels-to-scatter-plot-circles
|
||||
|
||||
# --instructions--
|
||||
|
||||
使用 `text` 元素标记散点图上的每个点。 标签的文本应该是用逗号和空格分隔的两个值。 例如,第一个点的标签为 "34, 78"。 设置 `x` 属性,使其比 `circle` 上 `cx` 属性使用的值多5个单位。 设置 `y` 属性的方式与 `circle` 上的 `cy` 值相同。
|
||||
使用 `text` 元素标记散点图上的每个点。 标签的文本应该是用逗号和空格分隔的两个值。 例如,第一个点的标签是 `34, 78`。 设置 `x` 属性,使其比 `circle` 上的 `cx` 属性的值多 `5` 个单位。 设置 `y` 属性的方式与 `circle` 上的 `cy` 值相同。
|
||||
|
||||
# --hints--
|
||||
|
||||
你应该有 10 个 `text` 元素。
|
||||
应该有 10 个 `text` 元素。
|
||||
|
||||
```js
|
||||
assert($('text').length == 10);
|
||||
```
|
||||
|
||||
第一个标签的文本应该为 '34, 78', `x` 值应该为 39, `y` 应该为 422。
|
||||
第一个标签的文本应为 `34, 78`, `x` 值应为 `39`,`y` 应为 `422`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -36,7 +36,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第二个标签的文本应该为 '109, 280', `x` 值应该为 114, `y` 应该为 220。
|
||||
第二个标签的文本应为 `109, 280`,`x` 值应为`114`,`y` 值应为 `220`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -46,7 +46,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第三个标签的文本应该为 '310, 120', `x` 值应该为 315, `y` 应该为 380。
|
||||
第三个标签的文本应为 `310, 120`,`x` 值应为 `315`,`y` 值应为 `380`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -56,7 +56,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第四个标签的文本应该为 '79, 411', `x` 值应该为 84, `y` 应该为 89。
|
||||
第四个标签的文本应为 `79, 411`,`x` 值应为 `84`,`y` 值应为 `89`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -66,7 +66,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第五个标签的文本应该为 '420, 220', `x` 值应该为 425, `y` 应该为 280。
|
||||
第五个标签的文本应为 `420, 220`,`x` 值应为 `425`,`y` 值应为 `280`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -76,7 +76,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第六个标签的文本应该为 '233, 145', `x` 值应该为 238, `y` 应该为 355。
|
||||
第六个标签的文本应为 `233, 145`,`x` 值应为 `238`,`y` 值应为 `355`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -86,7 +86,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第七个标签的文本应该为 '333, 96', `x` 值应该为 338, `y` 应该为 404。
|
||||
第七个标签的文本应为 `333, 96`,`x` 值应为 `338`,`y` 值应为 `404`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -96,7 +96,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第八个标签的文本应该为 '222, 333', `x` 值应该为 227, `y` 应该为 167。
|
||||
第八个标签的文本应为 `222, 333`,`x` 值应为 `227`,`y` 值应为 `167`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -106,7 +106,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第九个标签的文本应该为 '78, 320', `x` 值应该为 83, `y` 应该为 180。
|
||||
第九个标签的文本应为 `78, 320`,`x` 值应为 `83`,`y` 值应为 `180`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -116,7 +116,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
第十个标签的文本应该为 '21, 123', `x` 值应该为 26, `y` 应该为 377。
|
||||
第十个标签的文本应为 `21, 123`,`x` 值应为 `26`,`y` 值应为 `377`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5a94fe1369fb03452672e45d
|
||||
title: Ubica elementos en áreas de cuadrícula (grid) usando la propiedad grid-area
|
||||
title: Ubica elementos en áreas de cuadrícula usando la propiedad grid-area
|
||||
challengeType: 0
|
||||
videoUrl: 'https://scrimba.com/p/pByETK/cRrqmtV'
|
||||
forumTopicId: 301132
|
||||
@ -9,7 +9,7 @@ dashedName: place-items-in-grid-areas-using-the-grid-area-property
|
||||
|
||||
# --description--
|
||||
|
||||
Después de crear una plantilla de área para tu contenedor de cuadrícula, cómo se muestra en el desafío anterior, puedes ubicar un elemento en tu área personalizada referenciando el nombre que le diste. Para hacer esto, usa la propiedad `grid-area` sobre un elemento así:
|
||||
Después de crear una plantilla de área para tu contenedor de cuadrícula (grid), cómo se muestra en el desafío anterior, puedes ubicar un elemento en tu área personalizada referenciando el nombre que le diste. Para hacer esto, usa la propiedad `grid-area` sobre un elemento así:
|
||||
|
||||
```css
|
||||
.item1 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56bbb991ad1ed5201cd392ca
|
||||
title: Access Array Data with Indexes
|
||||
title: Accede a los datos de un arreglo con índices
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cBZQbTz'
|
||||
forumTopicId: 16158
|
||||
@ -9,30 +9,31 @@ dashedName: access-array-data-with-indexes
|
||||
|
||||
# --description--
|
||||
|
||||
We can access the data inside arrays using <dfn>indexes</dfn>.
|
||||
Podemos acceder a los datos dentro de un arreglo usando <dfn>índices</dfn>.
|
||||
|
||||
Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use <dfn>zero-based</dfn> indexing, so the first element in an array has an index of `0`.
|
||||
Los índices de los arreglos se escriben en la misma notación de corchetes que usan las cadenas de texto, con la excepción que en vez de especificar un carácter, se especifica una entrada en el arreglo. Así como las cadenas de texto, los arreglos usan indexación <dfn>empezando desde cero</dfn>, en donde el primer elemento de un arreglo tiene como índice `0`.
|
||||
|
||||
<br>
|
||||
|
||||
**Example**
|
||||
**Ejemplo**
|
||||
|
||||
```js
|
||||
var array = [50,60,70];
|
||||
array[0]; // equals 50
|
||||
var data = array[1]; // equals 60
|
||||
array[0];
|
||||
var data = array[1];
|
||||
```
|
||||
|
||||
**Note**
|
||||
There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
|
||||
`array[0]` ahora es `50` y `data` tiene el valor `60`.
|
||||
|
||||
**Nota:** No debe haber espacios entre el nombre del arreglo y los corchetes, como `array [0]`. Aunque JavaScript pueda procesar esto correctamente, puedes confundir a otros programadores al leer tu código.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Create a variable called `myData` and set it to equal the first value of `myArray` using bracket notation.
|
||||
Crea una variable llamada `myData` e iguálala al primer valor de `myArray` usando notación de corchetes.
|
||||
|
||||
# --hints--
|
||||
|
||||
The variable `myData` should equal the first value of `myArray`.
|
||||
La variable `myData` debe ser igual al primer valor de `myArray`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -50,7 +51,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The data in variable `myArray` should be accessed using bracket notation.
|
||||
Los datos en la variable `myArray` deben ser accedidos utilizando notación de corchetes.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56592a60ddddeae28f7aa8e1
|
||||
title: Access Multi-Dimensional Arrays With Indexes
|
||||
title: Accede a arreglos multidimensionales con índices
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/ckND4Cq'
|
||||
forumTopicId: 16159
|
||||
@ -9,9 +9,9 @@ dashedName: access-multi-dimensional-arrays-with-indexes
|
||||
|
||||
# --description--
|
||||
|
||||
One way to think of a <dfn>multi-dimensional</dfn> array, is as an *array of arrays*. When you use brackets to access your array, the first set of brackets refers to the entries in the outer-most (the first level) array, and each additional pair of brackets refers to the next level of entries inside.
|
||||
Se puede pensar que un arreglo <dfn>multidimensional</dfn> es como un *arreglo de arreglos*. Cuando usas corchetes para acceder a tu arreglo, el primer par de corchetes se refiere a las entradas en el arreglo externo (el primer nivel) y cada par adicional de corchetes se refiere al siguiente nivel de entradas.
|
||||
|
||||
**Example**
|
||||
**Ejemplo**
|
||||
|
||||
```js
|
||||
var arr = [
|
||||
@ -20,27 +20,28 @@ var arr = [
|
||||
[7,8,9],
|
||||
[[10,11,12], 13, 14]
|
||||
];
|
||||
arr[3]; // equals [[10,11,12], 13, 14]
|
||||
arr[3][0]; // equals [10,11,12]
|
||||
arr[3][0][1]; // equals 11
|
||||
arr[3];
|
||||
arr[3][0];
|
||||
arr[3][0][1];
|
||||
```
|
||||
|
||||
**Note**
|
||||
There shouldn't be any spaces between the array name and the square brackets, like `array [0][0]` and even this `array [0] [0]` is not allowed. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
|
||||
`arr[3]` es `[[10, 11, 12], 13, 14]`, `arr[3][0]` es `[10, 11, 12]` y `arr[3][0][1]` es `11`.
|
||||
|
||||
**Nota:** No debe haber ningún espacio entre el nombre del arreglo y los corchetes, ni `array [0][0]` o `array [0] [0]` están permitidos. Aunque JavaScript pueda procesar esto correctamente, puedes confundir a otros programadores al leer tu código.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Using bracket notation select an element from `myArray` such that `myData` is equal to `8`.
|
||||
Usa la notación de corchetes para seleccionar un elemento de `myArray` de tal manera que `myData` sea igual a `8`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`myData` should be equal to `8`.
|
||||
`myData` debe ser igual a `8`.
|
||||
|
||||
```js
|
||||
assert(myData === 8);
|
||||
```
|
||||
|
||||
You should be using bracket notation to read the correct value from `myArray`.
|
||||
Debes usar notación de corchetes para leer el valor correcto de `myArray`.
|
||||
|
||||
```js
|
||||
assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code)));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244cd
|
||||
title: Accessing Nested Arrays
|
||||
title: Accede a arreglos anidados
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cLeGDtZ'
|
||||
forumTopicId: 16160
|
||||
@ -9,9 +9,9 @@ dashedName: accessing-nested-arrays
|
||||
|
||||
# --description--
|
||||
|
||||
As we have seen in earlier examples, objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.
|
||||
Como hemos visto en ejemplos anteriores, los objetos pueden contener tanto objetos anidados como así también arreglos anidados. De manera similar a como se accede a los objetos anidados, la notación de corchetes de arreglos puede ser encadenada para acceder a arreglos anidados.
|
||||
|
||||
Here is an example of how to access a nested array:
|
||||
En el siguiente ejemplo, vemos cómo se accede a un arreglo anidado:
|
||||
|
||||
```js
|
||||
var ourPets = [
|
||||
@ -32,23 +32,25 @@ var ourPets = [
|
||||
]
|
||||
}
|
||||
];
|
||||
ourPets[0].names[1]; // "Fluffy"
|
||||
ourPets[1].names[0]; // "Spot"
|
||||
ourPets[0].names[1];
|
||||
ourPets[1].names[0];
|
||||
```
|
||||
|
||||
`ourPets[0].names[1]` sería la cadena `Fluffy`, y `ourPets[1].names[0]` sería la cadena `Spot`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Retrieve the second tree from the variable `myPlants` using object dot and array bracket notation.
|
||||
Obtén el segundo árbol de la variable `myPlants` usando la notación de puntos de objetos y la notación de corchetes de arreglos.
|
||||
|
||||
# --hints--
|
||||
|
||||
`secondTree` should equal "pine".
|
||||
`secondTree` debe ser igual a la cadena `pine`.
|
||||
|
||||
```js
|
||||
assert(secondTree === 'pine');
|
||||
```
|
||||
|
||||
Your code should use dot and bracket notation to access `myPlants`.
|
||||
Tu código debe usar las notaciones de puntos y de corchetes para acceder a `myPlants`.
|
||||
|
||||
```js
|
||||
assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244cc
|
||||
title: Accessing Nested Objects
|
||||
title: Accede a objetos anidados
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cRnRnfa'
|
||||
forumTopicId: 16161
|
||||
@ -9,9 +9,9 @@ dashedName: accessing-nested-objects
|
||||
|
||||
# --description--
|
||||
|
||||
The sub-properties of objects can be accessed by chaining together the dot or bracket notation.
|
||||
Se puede acceder a las sub propiedades de objetos encadenando la notación de puntos o corchetes.
|
||||
|
||||
Here is a nested object:
|
||||
Aquí hay un objeto anidado:
|
||||
|
||||
```js
|
||||
var ourStorage = {
|
||||
@ -26,23 +26,25 @@ var ourStorage = {
|
||||
"bottom drawer": "soda"
|
||||
}
|
||||
};
|
||||
ourStorage.cabinet["top drawer"].folder2; // "secrets"
|
||||
ourStorage.desk.drawer; // "stapler"
|
||||
ourStorage.cabinet["top drawer"].folder2;
|
||||
ourStorage.desk.drawer;
|
||||
```
|
||||
|
||||
`ourStorage.cabinet["top drawer"].folder2` sería la cadena `secrets` y `ourStorage.desk.drawer` sería la cadena `stapler`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Access the `myStorage` object and assign the contents of the `glove box` property to the `gloveBoxContents` variable. Use dot notation for all properties where possible, otherwise use bracket notation.
|
||||
Accede al objeto `myStorage` y asigna el contenido de la propiedad `glove box` a la variable `gloveBoxContents`. Utiliza la notación de puntos para todas las propiedades cuando sea posible, de lo contrario utiliza la notación de corchetes.
|
||||
|
||||
# --hints--
|
||||
|
||||
`gloveBoxContents` should equal "maps".
|
||||
`gloveBoxContents` debe ser igual a la cadena `maps`.
|
||||
|
||||
```js
|
||||
assert(gloveBoxContents === 'maps');
|
||||
```
|
||||
|
||||
Your code should use dot and bracket notation to access `myStorage`.
|
||||
Tu código debe utilizar notación de puntos y de corchetes para acceder a `myStorage`.
|
||||
|
||||
```js
|
||||
assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244c8
|
||||
title: Accessing Object Properties with Bracket Notation
|
||||
title: Accede a propiedades de objetos con notación de corchete
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cBvmEHP'
|
||||
forumTopicId: 16163
|
||||
@ -9,11 +9,11 @@ dashedName: accessing-object-properties-with-bracket-notation
|
||||
|
||||
# --description--
|
||||
|
||||
The second way to access the properties of an object is bracket notation (`[]`). If the property of the object you are trying to access has a space in its name, you will need to use bracket notation.
|
||||
La segunda manera de acceder a las propiedades de un objeto es con la notación de corchetes (`[]`). Si la propiedad del objeto al que intentas acceder tiene un espacio en el nombre, necesitarás usar notación de corchetes.
|
||||
|
||||
However, you can still use bracket notation on object properties without spaces.
|
||||
Sin embargo, también puedes utilizar la notación de corchetes en las propiedades de objeto sin espacios.
|
||||
|
||||
Here is a sample of using bracket notation to read an object's property:
|
||||
Aquí hay un ejemplo de cómo usar la notación de corchetes para leer la propiedad de un objeto:
|
||||
|
||||
```js
|
||||
var myObj = {
|
||||
@ -21,44 +21,46 @@ var myObj = {
|
||||
"More Space": "Spock",
|
||||
"NoSpace": "USS Enterprise"
|
||||
};
|
||||
myObj["Space Name"]; // Kirk
|
||||
myObj['More Space']; // Spock
|
||||
myObj["NoSpace"]; // USS Enterprise
|
||||
myObj["Space Name"];
|
||||
myObj['More Space'];
|
||||
myObj["NoSpace"];
|
||||
```
|
||||
|
||||
Note that property names with spaces in them must be in quotes (single or double).
|
||||
`myObj["Space Name"]` sería la cadena `Kirk`, `myObj['More Space']` sería la cadena `Spock`, y `myObj["NoSpace"]` sería la cadena `USS Enterprise`.
|
||||
|
||||
Ten en cuenta que los nombres de las propiedades con espacios deben estar entre comillas (simples o dobles).
|
||||
|
||||
# --instructions--
|
||||
|
||||
Read the values of the properties `"an entree"` and `"the drink"` of `testObj` using bracket notation and assign them to `entreeValue` and `drinkValue` respectively.
|
||||
Lee los valores de las propiedades `an entree` y `the drink` de `testObj` usando la notación de corchetes y asígnalos a `entreeValue` y `drinkValue` respectivamente.
|
||||
|
||||
# --hints--
|
||||
|
||||
`entreeValue` should be a string
|
||||
`entreeValue` debe ser una cadena de texto
|
||||
|
||||
```js
|
||||
assert(typeof entreeValue === 'string');
|
||||
```
|
||||
|
||||
The value of `entreeValue` should be `"hamburger"`
|
||||
El valor de `entreeValue` debe ser la cadena `hamburger`
|
||||
|
||||
```js
|
||||
assert(entreeValue === 'hamburger');
|
||||
```
|
||||
|
||||
`drinkValue` should be a string
|
||||
`drinkValue` debe ser una cadena
|
||||
|
||||
```js
|
||||
assert(typeof drinkValue === 'string');
|
||||
```
|
||||
|
||||
The value of `drinkValue` should be `"water"`
|
||||
El valor de `drinkValue` debe ser la cadena `water`
|
||||
|
||||
```js
|
||||
assert(drinkValue === 'water');
|
||||
```
|
||||
|
||||
You should use bracket notation twice
|
||||
Debes usar la notación de corchetes dos veces
|
||||
|
||||
```js
|
||||
assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244c7
|
||||
title: Accessing Object Properties with Dot Notation
|
||||
title: Accede a propiedades de objetos con notación de puntos
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cGryJs8'
|
||||
forumTopicId: 16164
|
||||
@ -9,52 +9,53 @@ dashedName: accessing-object-properties-with-dot-notation
|
||||
|
||||
# --description--
|
||||
|
||||
There are two ways to access the properties of an object: dot notation (`.`) and bracket notation (`[]`), similar to an array.
|
||||
Hay dos maneras de acceder a las propiedades de un objeto: notación de puntos (`.`) y notación de corchetes (`[]`), similar a un arreglo.
|
||||
|
||||
Dot notation is what you use when you know the name of the property you're trying to access ahead of time.
|
||||
La notación de puntos es lo que se usa cuando conoces el nombre de la propiedad a la que intentas acceder con antelación.
|
||||
|
||||
Here is a sample of using dot notation (`.`) to read an object's property:
|
||||
Aquí hay un ejemplo de cómo usar la notación de puntos (`.`) para leer la propiedad de un objeto:
|
||||
|
||||
```js
|
||||
var myObj = {
|
||||
prop1: "val1",
|
||||
prop2: "val2"
|
||||
};
|
||||
var prop1val = myObj.prop1; // val1
|
||||
var prop2val = myObj.prop2; // val2
|
||||
var prop1val = myObj.prop1;
|
||||
var prop2val = myObj.prop2;
|
||||
```
|
||||
|
||||
`prop1val` tendrá una cadena con valor `val1` y `prop2val` tendrá una cadena con valor `val2`.
|
||||
# --instructions--
|
||||
|
||||
Read in the property values of `testObj` using dot notation. Set the variable `hatValue` equal to the object's property `hat` and set the variable `shirtValue` equal to the object's property `shirt`.
|
||||
Lee los valores de las propiedades de `testObj` utilizando la notación de puntos. Asigna la variable `hatValue` igual a la propiedad `hat` del objeto y asigna la variable `shirtValue` igual a la propiedad `shirt` del objeto.
|
||||
|
||||
# --hints--
|
||||
|
||||
`hatValue` should be a string
|
||||
`hatValue` debe ser una cadena
|
||||
|
||||
```js
|
||||
assert(typeof hatValue === 'string');
|
||||
```
|
||||
|
||||
The value of `hatValue` should be `"ballcap"`
|
||||
El valor de `hatValue` debe ser la cadena `ballcap`
|
||||
|
||||
```js
|
||||
assert(hatValue === 'ballcap');
|
||||
```
|
||||
|
||||
`shirtValue` should be a string
|
||||
`shirtValue` debe ser una cadena
|
||||
|
||||
```js
|
||||
assert(typeof shirtValue === 'string');
|
||||
```
|
||||
|
||||
The value of `shirtValue` should be `"jersey"`
|
||||
El valor de `shirtValue` debe ser la cadena `jersey`
|
||||
|
||||
```js
|
||||
assert(shirtValue === 'jersey');
|
||||
```
|
||||
|
||||
You should use dot notation twice
|
||||
Debes usar la notación de puntos dos veces
|
||||
|
||||
```js
|
||||
assert(code.match(/testObj\.\w+/g).length > 1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244c9
|
||||
title: Accessing Object Properties with Variables
|
||||
title: Accede a propiedades de objetos con variables
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cnQyKur'
|
||||
forumTopicId: 16165
|
||||
@ -9,9 +9,9 @@ dashedName: accessing-object-properties-with-variables
|
||||
|
||||
# --description--
|
||||
|
||||
Another use of bracket notation on objects is to access a property which is stored as the value of a variable. This can be very useful for iterating through an object's properties or when accessing a lookup table.
|
||||
Otro uso de la notación de corchetes en objetos es acceder a una propiedad que está almacenada como el valor de una variable. Esto puede ser muy útil para iterar a través de las propiedades de un objeto o para acceder a una tabla de búsqueda.
|
||||
|
||||
Here is an example of using a variable to access a property:
|
||||
Aquí hay un ejemplo del uso de una variable para acceder a una propiedad:
|
||||
|
||||
```js
|
||||
var dogs = {
|
||||
@ -19,10 +19,12 @@ var dogs = {
|
||||
};
|
||||
var myDog = "Hunter";
|
||||
var myBreed = dogs[myDog];
|
||||
console.log(myBreed); // "Doberman"
|
||||
console.log(myBreed);
|
||||
```
|
||||
|
||||
Another way you can use this concept is when the property's name is collected dynamically during the program execution, as follows:
|
||||
La cadena `Doberman` se mostrará en la consola.
|
||||
|
||||
Otra forma de usar este concepto es cuando el nombre de la propiedad se recoge dinámicamente durante la ejecución del programa, de la siguiente manera:
|
||||
|
||||
```js
|
||||
var someObj = {
|
||||
@ -32,49 +34,51 @@ function propPrefix(str) {
|
||||
var s = "prop";
|
||||
return s + str;
|
||||
}
|
||||
var someProp = propPrefix("Name"); // someProp now holds the value 'propName'
|
||||
console.log(someObj[someProp]); // "John"
|
||||
var someProp = propPrefix("Name");
|
||||
console.log(someObj[someProp]);
|
||||
```
|
||||
|
||||
Note that we do *not* use quotes around the variable name when using it to access the property because we are using the *value* of the variable, not the *name*.
|
||||
`someProp` tendrá una cadena con un valor `propName` y la cadena `John` se mostrará en la consola.
|
||||
|
||||
Ten en cuenta que *no* usamos comillas alrededor del nombre de la variable cuando la usamos para acceder a la propiedad porque utilizamos el *valor* de la variable, no el *nombre*.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Set the `playerNumber` variable to `16`. Then, use the variable to look up the player's name and assign it to `player`.
|
||||
Establece la variable `playerNumber` a `16`. Luego, usa la variable para buscar el nombre del jugador y asignarlo a `player`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`playerNumber` should be a number
|
||||
`playerNumber` debe ser un número
|
||||
|
||||
```js
|
||||
assert(typeof playerNumber === 'number');
|
||||
```
|
||||
|
||||
The variable `player` should be a string
|
||||
La variable `player` debe ser una cadena
|
||||
|
||||
```js
|
||||
assert(typeof player === 'string');
|
||||
```
|
||||
|
||||
The value of `player` should be "Montana"
|
||||
El valor de `player` debe ser la cadena `Montana`
|
||||
|
||||
```js
|
||||
assert(player === 'Montana');
|
||||
```
|
||||
|
||||
You should use bracket notation to access `testObj`
|
||||
Debes usar la notación de corchete para acceder a `testObj`
|
||||
|
||||
```js
|
||||
assert(/testObj\s*?\[.*?\]/.test(code));
|
||||
```
|
||||
|
||||
You should not assign the value `Montana` to the variable `player` directly.
|
||||
No debes asignar el valor de `Montana` a la variable `player` directamente.
|
||||
|
||||
```js
|
||||
assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
|
||||
```
|
||||
|
||||
You should be using the variable `playerNumber` in your bracket notation
|
||||
Debes usar la variable `playerNumber` en tu notación de corchete
|
||||
|
||||
```js
|
||||
assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244d5
|
||||
title: Comparison with the Greater Than Or Equal To Operator
|
||||
title: Comparación con el operador "mayor o igual que"
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/c6KBqtV'
|
||||
forumTopicId: 16785
|
||||
@ -9,68 +9,70 @@ dashedName: comparison-with-the-greater-than-or-equal-to-operator
|
||||
|
||||
# --description--
|
||||
|
||||
The greater than or equal to operator (`>=`) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns `true`. Otherwise, it returns `false`.
|
||||
El operador mayor o igual que (`>=`) compara el valor de dos números. Si el número de la izquierda es mayor o igual que el número de la derecha, devuelve `true`. De lo contrario, devuelve `false`.
|
||||
|
||||
Like the equality operator, `greater than or equal to` operator will convert data types while comparing.
|
||||
Al igual que el operador de igualdad, `>=` convertirá los tipos de datos al comparar.
|
||||
|
||||
**Examples**
|
||||
**Ejemplos**
|
||||
|
||||
```js
|
||||
6 >= 6 // true
|
||||
7 >= '3' // true
|
||||
2 >= 3 // false
|
||||
'7' >= 9 // false
|
||||
6 >= 6
|
||||
7 >= '3'
|
||||
2 >= 3
|
||||
'7' >= 9
|
||||
```
|
||||
|
||||
En orden, estas expresiones se evaluarían como `true`, `true`, `false` y `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the greater than or equal to operator to the indicated lines so that the return statements make sense.
|
||||
Agrega el operador mayor o igual que a las líneas indicadas para que el valor devuelto tenga sentido.
|
||||
|
||||
# --hints--
|
||||
|
||||
`testGreaterOrEqual(0)` should return "Less than 10"
|
||||
`testGreaterOrEqual(0)` debe devolver la cadena `Less than 10`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(0) === 'Less than 10');
|
||||
```
|
||||
|
||||
`testGreaterOrEqual(9)` should return "Less than 10"
|
||||
`testGreaterOrEqual(9)` debe devolver la cadena `Less than 10`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(9) === 'Less than 10');
|
||||
```
|
||||
|
||||
`testGreaterOrEqual(10)` should return "10 or Over"
|
||||
`testGreaterOrEqual(10)` debe devolver la cadena `10 or Over`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(10) === '10 or Over');
|
||||
```
|
||||
|
||||
`testGreaterOrEqual(11)` should return "10 or Over"
|
||||
`testGreaterOrEqual(11)` debe devolver la cadena `10 or Over`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(11) === '10 or Over');
|
||||
```
|
||||
|
||||
`testGreaterOrEqual(19)` should return "10 or Over"
|
||||
`testGreaterOrEqual(19)` debe devolver la cadena `10 or Over`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(19) === '10 or Over');
|
||||
```
|
||||
|
||||
`testGreaterOrEqual(100)` should return "20 or Over"
|
||||
`testGreaterOrEqual(100)` debe devolver la cadena `20 or Over`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(100) === '20 or Over');
|
||||
```
|
||||
|
||||
`testGreaterOrEqual(21)` should return "20 or Over"
|
||||
`testGreaterOrEqual(21)` debe devolver la cadena `20 or Over`
|
||||
|
||||
```js
|
||||
assert(testGreaterOrEqual(21) === '20 or Over');
|
||||
```
|
||||
|
||||
You should use the `>=` operator at least twice
|
||||
Debes utilizar el operador `>=` al menos dos veces
|
||||
|
||||
```js
|
||||
assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244d2
|
||||
title: Comparison with the Inequality Operator
|
||||
title: Comparación con el operador de desigualdad
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cdBm9Sr'
|
||||
forumTopicId: 16787
|
||||
@ -9,55 +9,57 @@ dashedName: comparison-with-the-inequality-operator
|
||||
|
||||
# --description--
|
||||
|
||||
The inequality operator (`!=`) is the opposite of the equality operator. It means "Not Equal" and returns `false` where equality would return `true` and *vice versa*. Like the equality operator, the inequality operator will convert data types of values while comparing.
|
||||
El operador de desigualdad (`!=`) es lo opuesto al operador de igualdad. Esto quiere decir que no es igual, y devuelve `false` cuando la comparación de igualdad devuelva `true` y *vice versa*. Tal como el operador de igualdad, el operador de desigualdad convertirá los tipos de datos mientras compara.
|
||||
|
||||
**Examples**
|
||||
**Ejemplos**
|
||||
|
||||
```js
|
||||
1 != 2 // true
|
||||
1 != "1" // false
|
||||
1 != '1' // false
|
||||
1 != true // false
|
||||
0 != false // false
|
||||
1 != 2
|
||||
1 != "1"
|
||||
1 != '1'
|
||||
1 != true
|
||||
0 != false
|
||||
```
|
||||
|
||||
En orden, estas expresiones se evaluarían como `true`, `false`, `false`, `false` y `false`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the inequality operator `!=` in the `if` statement so that the function will return "Not Equal" when `val` is not equivalent to `99`
|
||||
Agrega el operador de desigualdad `!=` en la sentencia `if` para que la función devuelva la cadena `Not Equal` cuando `val` no sea equivalente a `99`
|
||||
|
||||
# --hints--
|
||||
|
||||
`testNotEqual(99)` should return "Equal"
|
||||
`testNotEqual(99)` debe devolver la cadena `Equal`
|
||||
|
||||
```js
|
||||
assert(testNotEqual(99) === 'Equal');
|
||||
```
|
||||
|
||||
`testNotEqual("99")` should return "Equal"
|
||||
`testNotEqual("99")` debe devolver la cadena `Equal`
|
||||
|
||||
```js
|
||||
assert(testNotEqual('99') === 'Equal');
|
||||
```
|
||||
|
||||
`testNotEqual(12)` should return "Not Equal"
|
||||
`testNotEqual(12)` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(testNotEqual(12) === 'Not Equal');
|
||||
```
|
||||
|
||||
`testNotEqual("12")` should return "Not Equal"
|
||||
`testNotEqual("12")` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(testNotEqual('12') === 'Not Equal');
|
||||
```
|
||||
|
||||
`testNotEqual("bob")` should return "Not Equal"
|
||||
`testNotEqual("bob")` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(testNotEqual('bob') === 'Not Equal');
|
||||
```
|
||||
|
||||
You should use the `!=` operator
|
||||
Debes utilizar el operador `!=`
|
||||
|
||||
```js
|
||||
assert(code.match(/(?!!==)!=/));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244d3
|
||||
title: Comparison with the Strict Inequality Operator
|
||||
title: Comparación con el operador de estricta desigualdad
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cKekkUy'
|
||||
forumTopicId: 16791
|
||||
@ -9,47 +9,49 @@ dashedName: comparison-with-the-strict-inequality-operator
|
||||
|
||||
# --description--
|
||||
|
||||
The strict inequality operator (`!==`) is the logical opposite of the strict equality operator. It means "Strictly Not Equal" and returns `false` where strict equality would return `true` and *vice versa*. Strict inequality will not convert data types.
|
||||
El operador de estricta desigualdad `!==` es el opuesto lógico del operador de estricta igualdad. Esto significa "Estrictamente No Igual", y devuelve `false` cuando la comparación de estricta igualdad devolvería `true` y *vice versa*. Una estricta desigualdad no convertirá los tipos de datos.
|
||||
|
||||
**Examples**
|
||||
**Ejemplos**
|
||||
|
||||
```js
|
||||
3 !== 3 // false
|
||||
3 !== '3' // true
|
||||
4 !== 3 // true
|
||||
3 !== 3
|
||||
3 !== '3'
|
||||
4 !== 3
|
||||
```
|
||||
|
||||
En orden, estas expresiones se evaluarían como `false`, `true` y `true`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the strict inequality operator to the `if` statement so the function will return "Not Equal" when `val` is not strictly equal to `17`
|
||||
Agrega el operador de estricta desigualdad a la sentencia `if` para que la función devuelva la cadena `Not Equal` cuando `val` no sea estrictamente igual a `17`
|
||||
|
||||
# --hints--
|
||||
|
||||
`testStrictNotEqual(17)` should return "Equal"
|
||||
`testStrictNotEqual(17)` debe devolver la cadena `Equal`
|
||||
|
||||
```js
|
||||
assert(testStrictNotEqual(17) === 'Equal');
|
||||
```
|
||||
|
||||
`testStrictNotEqual("17")` should return "Not Equal"
|
||||
`testStrictNotEqual("17")` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(testStrictNotEqual('17') === 'Not Equal');
|
||||
```
|
||||
|
||||
`testStrictNotEqual(12)` should return "Not Equal"
|
||||
`testStrictNotEqual(12)` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(testStrictNotEqual(12) === 'Not Equal');
|
||||
```
|
||||
|
||||
`testStrictNotEqual("bob")` should return "Not Equal"
|
||||
`testStrictNotEqual("bob")` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(testStrictNotEqual('bob') === 'Not Equal');
|
||||
```
|
||||
|
||||
You should use the `!==` operator
|
||||
Debes usar el operador `!==`
|
||||
|
||||
```js
|
||||
assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: cf1111c1c12feddfaeb2bdef
|
||||
title: Generate Random Whole Numbers within a Range
|
||||
title: Genera números enteros aleatorios dentro de un rango
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cm83yu6'
|
||||
forumTopicId: 18187
|
||||
@ -9,39 +9,39 @@ dashedName: generate-random-whole-numbers-within-a-range
|
||||
|
||||
# --description--
|
||||
|
||||
Instead of generating a random whole number between zero and a given number like we did before, we can generate a random whole number that falls within a range of two specific numbers.
|
||||
En lugar de generar un número entero aleatorio entre cero y un número dado como lo hicimos anteriormente, podemos generar un número entero aleatorio que se encuentre dentro de un rango de dos números específicos.
|
||||
|
||||
To do this, we'll define a minimum number `min` and a maximum number `max`.
|
||||
Para ello, definiremos un número mínimo `min` y un número máximo `max`.
|
||||
|
||||
Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing:
|
||||
Esta es la fórmula que utilizaremos. Tómate un momento para leerla e intenta entender lo que este código está haciendo:
|
||||
|
||||
`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 is less than or equal to `myMax`, inclusive.
|
||||
Crea una función llamada `randomRange` que tenga un rango `myMin` y `myMax` y devuelva un número entero aleatorio mayor o igual a `myMin`, y es menor o igual a `myMax`, inclusivo.
|
||||
|
||||
# --hints--
|
||||
|
||||
The lowest random number that can be generated by `randomRange` should be equal to your minimum number, `myMin`.
|
||||
El número aleatorio más bajo que puede ser generado por `randomRange` debe ser igual a tu número mínimo, `myMin`.
|
||||
|
||||
```js
|
||||
assert(calcMin === 5);
|
||||
```
|
||||
|
||||
The highest random number that can be generated by `randomRange` should be equal to your maximum number, `myMax`.
|
||||
El número aleatorio más alto que puede ser generado por `randomRange` debe ser igual a tu número máximo, `myMax`.
|
||||
|
||||
```js
|
||||
assert(calcMax === 15);
|
||||
```
|
||||
|
||||
The random number generated by `randomRange` should be an integer, not a decimal.
|
||||
El número aleatorio generado por `randomRange` debe ser un entero, no un decimal.
|
||||
|
||||
```js
|
||||
assert(randomRange(0, 1) % 1 === 0);
|
||||
```
|
||||
|
||||
`randomRange` should use both `myMax` and `myMin`, and return a random number in your range.
|
||||
`randomRange` debe usar `myMax` y `myMin`, y devolver un número aleatorio en tu rango.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5cfa3679138e7d9595b9d9d4
|
||||
title: Replace Loops using Recursion
|
||||
title: Reemplaza bucles usando recursión
|
||||
challengeType: 1
|
||||
videoUrl: >-
|
||||
https://www.freecodecamp.org/news/how-recursion-works-explained-with-flowcharts-and-a-video-de61f40cb7f9/
|
||||
@ -10,7 +10,7 @@ dashedName: replace-loops-using-recursion
|
||||
|
||||
# --description--
|
||||
|
||||
Recursion is the concept that a function can be expressed in terms of itself. To help understand this, start by thinking about the following task: multiply the first `n` elements of an array to create the product of those elements. Using a `for` loop, you could do this:
|
||||
La recursión es el concepto que una función puede expresarse en términos de sí misma. Para ayudar a comprender esto, comienza pensando en la siguiente tarea: multiplica los primeros `n` elementos de un arreglo para crear el producto de esos elementos. Usando un bucle `for`, puedes hacer esto:
|
||||
|
||||
```js
|
||||
function multiply(arr, n) {
|
||||
@ -22,7 +22,7 @@ Recursion is the concept that a function can be expressed in terms of itself. To
|
||||
}
|
||||
```
|
||||
|
||||
However, notice that `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. That means you can rewrite `multiply` in terms of itself and never need to use a loop.
|
||||
Sin embargo, nota que `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. Esto significa que puedes reescribir `multiply` en términos de sí misma y que nunca necesites hacer uso de un bucle.
|
||||
|
||||
```js
|
||||
function multiply(arr, n) {
|
||||
@ -34,35 +34,35 @@ However, notice that `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. Th
|
||||
}
|
||||
```
|
||||
|
||||
The recursive version of `multiply` breaks down like this. In the <dfn>base case</dfn>, where `n <= 0`, it returns 1. For larger values of `n`, it calls itself, but with `n - 1`. That function call is evaluated in the same way, calling `multiply` again until `n <= 0`. At this point, all the functions can return and the original `multiply` returns the answer.
|
||||
La versión recursiva de `multiply` se desglosa así. En el <dfn>caso base</dfn>, donde `n <= 0`, devuelve 1. Para valores más grandes de `n`, se llama a sí misma, pero con `n - 1`. Esa llamada de función se evalúa de la misma manera, llamando a `multiply` otra vez hasta que `n <= 0`. En este punto, todas las funciones pueden devolver y la `multiply` original devuelve la respuesta.
|
||||
|
||||
**Note:** Recursive functions must have a base case when they return without calling the function again (in this example, when `n <= 0`), otherwise they can never finish executing.
|
||||
**Nota:** Las funciones recursivas deben tener un caso base cuando devuelven sin tener que llamar a la función de nuevo (en este ejemplo, cuando `n <= 0`), de lo contrario nunca podrán terminar de ejecutarse.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Write a recursive function, `sum(arr, n)`, that returns the sum of the first `n` elements of an array `arr`.
|
||||
Escribe una función recursiva, `sum(arr, n)`, que devuelve la suma de los primeros elementos `n` de un arreglo `arr`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`sum([1], 0)` should equal 0.
|
||||
`sum([1], 0)` debe ser igual a 0.
|
||||
|
||||
```js
|
||||
assert.equal(sum([1], 0), 0);
|
||||
```
|
||||
|
||||
`sum([2, 3, 4], 1)` should equal 2.
|
||||
`sum([2, 3, 4], 1)` debe ser igual a 2.
|
||||
|
||||
```js
|
||||
assert.equal(sum([2, 3, 4], 1), 2);
|
||||
```
|
||||
|
||||
`sum([2, 3, 4, 5], 3)` should equal 9.
|
||||
`sum([2, 3, 4, 5], 3)` debe ser igual a 9.
|
||||
|
||||
```js
|
||||
assert.equal(sum([2, 3, 4, 5], 3), 9);
|
||||
```
|
||||
|
||||
Your code should not rely on any kind of loops (`for` or `while` or higher order functions such as `forEach`, `map`, `filter`, or `reduce`.).
|
||||
Tu código no debe depender de ningún tipo de bluces (`for` o `while`) o funciones de orden alto tales como `forEach`, `map`, `filter`, o `reduce`.).
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -72,7 +72,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
You should use recursion to solve this problem.
|
||||
Debes usar recursión para resolver este problema.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b87367417b2b2512b40
|
||||
title: Compare Scopes of the var and let Keywords
|
||||
title: Compara el alcance de las palabras clave "var" y "let"
|
||||
challengeType: 1
|
||||
forumTopicId: 301195
|
||||
dashedName: compare-scopes-of-the-var-and-let-keywords
|
||||
@ -8,11 +8,11 @@ dashedName: compare-scopes-of-the-var-and-let-keywords
|
||||
|
||||
# --description--
|
||||
|
||||
When you declare a variable with the `var` keyword, it is declared globally, or locally if declared inside a function.
|
||||
Cuando tú declaras una variable con la palabra `var`, esta es declarada globalmente o localmente sí es declarada dentro de una función.
|
||||
|
||||
The `let` keyword behaves similarly, but with some extra features. When you declare a variable with the `let` keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression.
|
||||
La palabra `let` se comporta de forma similar, pero con algunas funciones adicionales. Cuanto tú declaras una variable con la palabra `let` dentro de un bloque, una declaración o expresión. Su alcance está limitado a ese bloque, declaración o expresión.
|
||||
|
||||
For example:
|
||||
Por ejemplo:
|
||||
|
||||
```js
|
||||
var numArray = [];
|
||||
@ -20,12 +20,12 @@ for (var i = 0; i < 3; i++) {
|
||||
numArray.push(i);
|
||||
}
|
||||
console.log(numArray);
|
||||
// returns [0, 1, 2]
|
||||
console.log(i);
|
||||
// returns 3
|
||||
```
|
||||
|
||||
With the `var` keyword, `i` is declared globally. So when `i++` is executed, it updates the global variable. This code is similar to the following:
|
||||
Aquí la consola mostrará los valores `[0, 1, 2]` y `3`.
|
||||
|
||||
Con la palabra clave `var`, `i` es declarada globalmente. Así, cuando se ejecuta la instrucción `i++`, la variable global es actualizada. Este código es similar al siguiente:
|
||||
|
||||
```js
|
||||
var numArray = [];
|
||||
@ -34,12 +34,12 @@ for (i = 0; i < 3; i++) {
|
||||
numArray.push(i);
|
||||
}
|
||||
console.log(numArray);
|
||||
// returns [0, 1, 2]
|
||||
console.log(i);
|
||||
// returns 3
|
||||
```
|
||||
|
||||
This behavior will cause problems if you were to create a function and store it for later use inside a for loop that uses the `i` variable. This is because the stored function will always refer to the value of the updated global `i` variable.
|
||||
Aquí la consola mostrará los valores `[0, 1, 2]` y `3`.
|
||||
|
||||
Este comportamiento causará problemas si creas una función y la almacenas para su uso posterior dentro de un bucle `for` que usa la variable `i`. Esto se debe a que la función almacenada siempre se referirá al valor de la variable global `i` actualizada.
|
||||
|
||||
```js
|
||||
var printNumTwo;
|
||||
@ -51,10 +51,11 @@ for (var i = 0; i < 3; i++) {
|
||||
}
|
||||
}
|
||||
console.log(printNumTwo());
|
||||
// returns 3
|
||||
```
|
||||
|
||||
As you can see, `printNumTwo()` prints 3 and not 2. This is because the value assigned to `i` was updated and the `printNumTwo()` returns the global `i` and not the value `i` had when the function was created in the for loop. The `let` keyword does not follow this behavior:
|
||||
Aquí la consola mostrará el valor `3`.
|
||||
|
||||
Como puedes ver, `printNumTwo()` imprime 3 y no 2. Esto se debe a que el valor asignado a `i` se actualizó y la función `printNumTwo()` devuelve el valor de la variable `i` global y no el valor que tenía `i` cuando la función fue creada en el bucle for. La palabra clave `let` no sigue este comportamiento:
|
||||
|
||||
```js
|
||||
let printNumTwo;
|
||||
@ -66,28 +67,28 @@ for (let i = 0; i < 3; i++) {
|
||||
}
|
||||
}
|
||||
console.log(printNumTwo());
|
||||
// returns 2
|
||||
console.log(i);
|
||||
// returns "i is not defined"
|
||||
```
|
||||
|
||||
`i` is not defined because it was not declared in the global scope. It is only declared within the for loop statement. `printNumTwo()` returned the correct value because three different `i` variables with unique values (0, 1, and 2) were created by the `let` keyword within the loop statement.
|
||||
Aquí la consola mostrará el valor `2` y el error `i is not defined`.
|
||||
|
||||
`i` no está definida, porque no ha sido declarada en el ámbito global. Solo ha sido declarada dentro de la instrucción de bucle `for`. `printNumTwo()` devolvió el valor correcto porque la palabra clave `let` creó tres variables `i` diferentes con valores únicos (0, 1 y 2) dentro de la declaración de bucle.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Fix the code so that `i` declared in the if statement is a separate variable than `i` declared in the first line of the function. Be certain not to use the `var` keyword anywhere in your code.
|
||||
Corrige el código para que la variable `i`, declarado en la sentencia `if` sea una variable separada de la variable `i`, declarada en la primera línea de la función. Asegúrate de no utilizar la palabra clave `var` en ninguna parte de tu código.
|
||||
|
||||
This exercise is designed to illustrate the difference between how `var` and `let` keywords assign scope to the declared variable. When programming a function similar to the one used in this exercise, it is often better to use different variable names to avoid confusion.
|
||||
Este ejercicio está diseñado para ilustrar la diferencia entre cómo las palabras clave `var` y `let` asignan alcance a la variable declarada. Al programar una función similar a la utilizada en este ejercicio, suele ser mejor usar diferentes nombres de variable para evitar confusiones.
|
||||
|
||||
# --hints--
|
||||
|
||||
`var` should not exist in code.
|
||||
`var` no debería existir en el código.
|
||||
|
||||
```js
|
||||
(getUserInput) => assert(!getUserInput('index').match(/var/g));
|
||||
```
|
||||
|
||||
The variable `i` declared in the if statement should equal "block scope".
|
||||
La variable `i` declarada en la instrucción `if` debe ser igual a la cadena `block scope`.
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
@ -96,7 +97,7 @@ The variable `i` declared in the if statement should equal "block scope".
|
||||
);
|
||||
```
|
||||
|
||||
`checkScope()` should return "function scope"
|
||||
`checkScope()` debe devolver la cadena `function scope`
|
||||
|
||||
```js
|
||||
assert(checkScope() === 'function scope');
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: aa2e6f85cab2ab736c9a9b24
|
||||
title: Cash Register
|
||||
title: Caja registradora
|
||||
challengeType: 5
|
||||
forumTopicId: 16012
|
||||
dashedName: cash-register
|
||||
@ -8,21 +8,21 @@ dashedName: cash-register
|
||||
|
||||
# --description--
|
||||
|
||||
Design a cash register drawer function `checkCashRegister()` that accepts purchase price as the first argument (`price`), payment as the second argument (`cash`), and cash-in-drawer (`cid`) as the third argument.
|
||||
Diseña una función `checkCashRegister()` que acepte el precio de compra como primer argumento (`price`), la cantidad pagada como segundo argumento (`cash`), y el dinero en efectivo que tiene la caja (`cid`) como tercer argumento.
|
||||
|
||||
`cid` is a 2D array listing available currency.
|
||||
`cid` es un arreglo 2D que enumera las monedas disponibles.
|
||||
|
||||
The `checkCashRegister()` function should always return an object with a `status` key and a `change` key.
|
||||
La función `checkCashRegister()` siempre debe devolver un objeto con una clave `status` y una clave `change`.
|
||||
|
||||
Return `{status: "INSUFFICIENT_FUNDS", change: []}` if cash-in-drawer is less than the change due, or if you cannot return the exact change.
|
||||
Devuelve `{status: "INSUFFICIENT_FUNDS", change: []}` si el efectivo en caja es menor que el cambio necesario, o si no puedes devolver el cambio exacto.
|
||||
|
||||
Return `{status: "CLOSED", change: [...]}` with cash-in-drawer as the value for the key `change` if it is equal to the change due.
|
||||
Devuelve `{status: "CLOSED", change: [...]}` si el efectivo en caja como valor de la clave `change` es igual al cambio que se debe entregar.
|
||||
|
||||
Otherwise, return `{status: "OPEN", change: [...]}`, with the change due in coins and bills, sorted in highest to lowest order, as the value of the `change` key.
|
||||
En cualquier otro caso, devuelve `{status: "OPEN", change: [...]}`, con el cambio a entregar en monedas y billetes, ordenados de mayor a menor, como valor de la clave `change`.
|
||||
|
||||
<table class='table table-striped'><tbody><tr><th>Currency Unit</th><th>Amount</th></tr><tr><td>Penny</td><td>$0.01 (PENNY)</td></tr><tr><td>Nickel</td><td>$0.05 (NICKEL)</td></tr><tr><td>Dime</td><td>$0.1 (DIME)</td></tr><tr><td>Quarter</td><td>$0.25 (QUARTER)</td></tr><tr><td>Dollar</td><td>$1 (ONE)</td></tr><tr><td>Five Dollars</td><td>$5 (FIVE)</td></tr><tr><td>Ten Dollars</td><td>$10 (TEN)</td></tr><tr><td>Twenty Dollars</td><td>$20 (TWENTY)</td></tr><tr><td>One-hundred Dollars</td><td>$100 (ONE HUNDRED)</td></tr></tbody></table>
|
||||
<table class='table table-striped'><tbody><tr><th>Unidad Monetaria</th><th>Importe</th></tr><tr><td>Penny</td><td>$0.01 (PENNY)</td></tr><tr><td>Nickel</td><td>$0.05 (NICKEL)</td></tr><tr><td>Dime</td><td>$0.1 (DIME)</td></tr><tr><td>Quarter</td><td>$0.25 (QUARTER)</td></tr><tr><td>Dollar</td><td>$1 (ONE)</td></tr><tr><td>Five Dollars</td><td>$5 (FIVE)</td></tr><tr><td>Ten Dollars</td><td>$10 (TEN)</td></tr><tr><td>Twenty Dollars</td><td>$20 (TWENTY)</td></tr><tr><td>One-hundred Dollars</td><td>$100 (ONE HUNDRED)</td></tr></tbody></table>
|
||||
|
||||
See below for an example of a cash-in-drawer array:
|
||||
A continuación, un ejemplo del efectivo en caja en formato de arreglo:
|
||||
|
||||
```js
|
||||
[
|
||||
@ -40,7 +40,7 @@ See below for an example of a cash-in-drawer array:
|
||||
|
||||
# --hints--
|
||||
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return an object.
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` debe devolver un objeto.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
@ -61,7 +61,7 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return `{status: "OPEN", change: [["QUARTER", 0.5]]}`.
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` debe devolver `{status: "OPEN", change: [["QUARTER", 0.5]]}`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
@ -80,7 +80,7 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return `{status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}`.
|
||||
`checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` debe devolver `{status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
@ -110,7 +110,7 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` should return `{status: "INSUFFICIENT_FUNDS", change: []}`.
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` debe devolver `{status: "INSUFFICIENT_FUNDS", change: []}`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
@ -129,7 +129,7 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` should return `{status: "INSUFFICIENT_FUNDS", change: []}`.
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` debe devolver `{status: "INSUFFICIENT_FUNDS", change: []}`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
@ -148,7 +148,7 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` should return `{status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}`.
|
||||
`checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])` debe devolver `{status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
|
Reference in New Issue
Block a user