chore(i18n,curriculum): update translations (#43332)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 561add10cb82ac38a17523bc
|
id: 561add10cb82ac38a17523bc
|
||||||
title: API 和微服務證書
|
title: 後端開發和API證書
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5a553ca864b52e1d8bceea14
|
id: 5a553ca864b52e1d8bceea14
|
||||||
title: 數據可視化證書
|
title: Data Visualization Certificate
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 561acd10cb82ac38a17513bc
|
id: 561acd10cb82ac38a17513bc
|
||||||
title: 前端庫證書
|
title: 前端開發庫證書
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -18,4 +18,4 @@ tests:
|
|||||||
title: 電話號碼驗證器
|
title: 電話號碼驗證器
|
||||||
-
|
-
|
||||||
id: aa2e6f85cab2ab736c9a9b24
|
id: aa2e6f85cab2ab736c9a9b24
|
||||||
title: 計算找零
|
title: 現金登記
|
||||||
|
@ -24,7 +24,7 @@ tests:
|
|||||||
title: 編寫一個投票程序
|
title: 編寫一個投票程序
|
||||||
-
|
-
|
||||||
id: bd7158d8c443eddfaeb5bdff
|
id: bd7158d8c443eddfaeb5bdff
|
||||||
title: 建立一個夜生活協調程序
|
title: 建立一個夜間生活協調程序
|
||||||
-
|
-
|
||||||
id: bd7158d8c443eddfaeb5bd0e
|
id: bd7158d8c443eddfaeb5bd0e
|
||||||
title: 繪製股市圖
|
title: 繪製股市圖
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5e46fc95ac417301a38fb935
|
id: 5e46fc95ac417301a38fb935
|
||||||
title: Python 與機器學習證書
|
title: Machine Learning with Python Certificate
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -6,10 +6,10 @@ isPrivate: true
|
|||||||
tests:
|
tests:
|
||||||
-
|
-
|
||||||
id: 587d8249367417b2b2512c41
|
id: 587d8249367417b2b2512c41
|
||||||
title: 公制 - 英制轉換器
|
title: 公英制轉換器
|
||||||
-
|
-
|
||||||
id: 587d8249367417b2b2512c42
|
id: 587d8249367417b2b2512c42
|
||||||
title: 問題跟蹤器
|
title: 問題追蹤器
|
||||||
-
|
-
|
||||||
id: 587d824a367417b2b2512c43
|
id: 587d824a367417b2b2512c43
|
||||||
title: 個人圖書館
|
title: 個人圖書館
|
||||||
|
@ -18,4 +18,4 @@ tests:
|
|||||||
title: 元素週期表數據庫
|
title: 元素週期表數據庫
|
||||||
-
|
-
|
||||||
id: 602da04c22201c65d2a019f4
|
id: 602da04c22201c65d2a019f4
|
||||||
title: 終極挑戰
|
title: 猜數字遊戲
|
||||||
|
@ -11,8 +11,6 @@ dashedName: move-a-relatively-positioned-element-with-css-offsets
|
|||||||
|
|
||||||
CSS 裏面的 `top`、`bottom`、`left` 和 `right` 定義了元素在相應方位的偏移距離。 元素將從當前位置向屬性相反的方向偏移。 就像你在上一個挑戰看到的,`top` 屬性使 `h2` 向下移動。 同樣,使用 `left` 將項目移動到右邊。
|
CSS 裏面的 `top`、`bottom`、`left` 和 `right` 定義了元素在相應方位的偏移距離。 元素將從當前位置向屬性相反的方向偏移。 就像你在上一個挑戰看到的,`top` 屬性使 `h2` 向下移動。 同樣,使用 `left` 將項目移動到右邊。
|
||||||
|
|
||||||
<img src='https://i.imgur.com/eWWi3gZ.gif' alt='' />
|
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
請通過 CSS 屬性把 `h2` 向上移動 10 像素,向右移動 15 像素。
|
請通過 CSS 屬性把 `h2` 向上移動 10 像素,向右移動 15 像素。
|
||||||
|
@ -46,7 +46,7 @@ Here's a <a href="https://www.freecodecamp.org" target="_blank">link to www.free
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
創建一個新的段落 `p` 元素來包裹 `a` 元素。 新段落應有文本 `View more cat photos`,其中 `cat photos` 是一個鏈接,其餘是純文本。
|
創建一個新的段落 `p` 元素來包裹 `a` 元素。 不要創建一個新的錨點標籤。 新段落應有文本 `View more cat photos`,其中 `cat photos` 是一個鏈接,其餘是純文本。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ dashedName: use-the-value-attribute-with-radio-buttons-and-checkboxes
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
給每一個 `radio` 和 `checkbox` 輸入框添加 `value` 屬性。 使用輸入標籤的文本,小寫形式,作爲屬性的值。
|
給每一個 `radio` 和 `checkbox` 輸入框添加 `value` 屬性。 不要創建任何新的 radio 或 checkbox 元素。 輸入框標籤文本使用小寫字母作爲屬性值。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ assert.deepEqual(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
第一個數組中的所有元素都應按原始順序添加到第二個數組中。
|
第一個數組中的所有元素都應按原始順序添加到第二個數組中。 `frankenSplice([1, 2, 3, 4], [], 0)` 應返回 `[1, 2, 3, 4]`。
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);
|
assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);
|
||||||
|
@ -28,7 +28,7 @@ var ourStr = "I come first. " + "I come second.";
|
|||||||
字符串 `I come first. I come second.` 將顯示在控制檯中。
|
字符串 `I come first. I come second.` 將顯示在控制檯中。
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
使用 `+` 操作符連接字符串`This is the start.` 和 `This is the end.` 賦值給 `myStr` 。
|
用字符串 `This is the start.` 和 `This is the end.` 通過 `+` 運算符創建 `myStr`。 確保在兩個字符串之間包含一個空格。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ ourStr += "I come second.";
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
使用 `+=` 操作符,多行合併字符串 `This is the first sentence.` 和 `This is the second sentence.` ,並賦值給 `myStr` 。 像示例那樣使用 `+=` 操作符。 先把第一個字符串賦值給 `myStr`,然後拼接第二個字符串。
|
使用 `+=` 操作符,多行合併字符串 `This is the first sentence.` 和 `This is the second sentence.` ,並賦值給 `myStr` 。 參照示例中顯示的方式使用 `+=` 操作符,並確保在兩個字符串之間包含一個空格。 先把第一個字符串賦值給 `myStr`,然後拼接第二個字符串。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ dashedName: escape-sequences-in-strings
|
|||||||
|
|
||||||
你需要使用轉義字符正確地插入特殊字符。 確保間距與上面文本一致,並且單詞或轉義字符之間沒有空格。
|
你需要使用轉義字符正確地插入特殊字符。 確保間距與上面文本一致,並且單詞或轉義字符之間沒有空格。
|
||||||
|
|
||||||
**注意:** `SecondLine` 是因爲鍵入了轉義字符(而不是空格),所以在那個位置。
|
**注意:**`SecondLine` 前面的空白是製表符,而不是空格。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: iterate-over-all-properties
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
現在你已經瞭解了兩種屬性: <dfn>自身屬性</dfn>和 `prototype` 屬性。 自身屬性是直接在對象上定義的。 而 `prototype` 屬性是定義在 `prototype` 上的。
|
現在你已經瞭解了兩種屬性: <dfn>自身屬性</dfn>和 `prototype` 屬性。 自身屬性是直接在對象上定義的。 而原型屬性在 `prototype` 上定義。
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function Bird(name) {
|
function Bird(name) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 561add10cb82ac38a17523bc
|
id: 561add10cb82ac38a17523bc
|
||||||
title: API 和微服务证书
|
title: 后端开发和API证书
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5a553ca864b52e1d8bceea14
|
id: 5a553ca864b52e1d8bceea14
|
||||||
title: 数据可视化证书
|
title: Data Visualization Certificate
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 561acd10cb82ac38a17513bc
|
id: 561acd10cb82ac38a17513bc
|
||||||
title: 前端库证书
|
title: 前端开发库证书
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -18,4 +18,4 @@ tests:
|
|||||||
title: 电话号码验证器
|
title: 电话号码验证器
|
||||||
-
|
-
|
||||||
id: aa2e6f85cab2ab736c9a9b24
|
id: aa2e6f85cab2ab736c9a9b24
|
||||||
title: 计算找零
|
title: 现金登记
|
||||||
|
@ -24,7 +24,7 @@ tests:
|
|||||||
title: 编写一个投票程序
|
title: 编写一个投票程序
|
||||||
-
|
-
|
||||||
id: bd7158d8c443eddfaeb5bdff
|
id: bd7158d8c443eddfaeb5bdff
|
||||||
title: 建立一个夜生活协调程序
|
title: 建立一个夜间生活协调程序
|
||||||
-
|
-
|
||||||
id: bd7158d8c443eddfaeb5bd0e
|
id: bd7158d8c443eddfaeb5bd0e
|
||||||
title: 绘制股市图
|
title: 绘制股市图
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5e46fc95ac417301a38fb935
|
id: 5e46fc95ac417301a38fb935
|
||||||
title: Python 与机器学习证书
|
title: Machine Learning with Python Certificate
|
||||||
challengeType: 7
|
challengeType: 7
|
||||||
isPrivate: true
|
isPrivate: true
|
||||||
tests:
|
tests:
|
||||||
|
@ -6,10 +6,10 @@ isPrivate: true
|
|||||||
tests:
|
tests:
|
||||||
-
|
-
|
||||||
id: 587d8249367417b2b2512c41
|
id: 587d8249367417b2b2512c41
|
||||||
title: 公制 - 英制转换器
|
title: 公英制转换器
|
||||||
-
|
-
|
||||||
id: 587d8249367417b2b2512c42
|
id: 587d8249367417b2b2512c42
|
||||||
title: 问题跟踪器
|
title: 问题追踪器
|
||||||
-
|
-
|
||||||
id: 587d824a367417b2b2512c43
|
id: 587d824a367417b2b2512c43
|
||||||
title: 个人图书馆
|
title: 个人图书馆
|
||||||
|
@ -18,4 +18,4 @@ tests:
|
|||||||
title: 元素周期表数据库
|
title: 元素周期表数据库
|
||||||
-
|
-
|
||||||
id: 602da04c22201c65d2a019f4
|
id: 602da04c22201c65d2a019f4
|
||||||
title: 终极挑战
|
title: 猜数字游戏
|
||||||
|
@ -11,8 +11,6 @@ dashedName: move-a-relatively-positioned-element-with-css-offsets
|
|||||||
|
|
||||||
CSS 里面的 `top`、`bottom`、`left` 和 `right` 定义了元素在相应方位的偏移距离。 元素将从当前位置向属性相反的方向偏移。 就像你在上一个挑战看到的,`top` 属性使 `h2` 向下移动。 同样,使用 `left` 将项目移动到右边。
|
CSS 里面的 `top`、`bottom`、`left` 和 `right` 定义了元素在相应方位的偏移距离。 元素将从当前位置向属性相反的方向偏移。 就像你在上一个挑战看到的,`top` 属性使 `h2` 向下移动。 同样,使用 `left` 将项目移动到右边。
|
||||||
|
|
||||||
<img src='https://i.imgur.com/eWWi3gZ.gif' alt='' />
|
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
请通过 CSS 属性把 `h2` 向上移动 10 像素,向右移动 15 像素。
|
请通过 CSS 属性把 `h2` 向上移动 10 像素,向右移动 15 像素。
|
||||||
|
@ -46,7 +46,7 @@ Here's a <a href="https://www.freecodecamp.org" target="_blank">link to www.free
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
创建一个新的段落 `p` 元素来包裹 `a` 元素。 新段落应有文本 `View more cat photos`,其中 `cat photos` 是一个链接,其余是纯文本。
|
创建一个新的段落 `p` 元素来包裹 `a` 元素。 不要创建一个新的锚点标签。 新段落应有文本 `View more cat photos`,其中 `cat photos` 是一个链接,其余是纯文本。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ dashedName: use-the-value-attribute-with-radio-buttons-and-checkboxes
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
给每一个 `radio` 和 `checkbox` 输入框添加 `value` 属性。 使用输入标签的文本,小写形式,作为属性的值。
|
给每一个 `radio` 和 `checkbox` 输入框添加 `value` 属性。 不要创建任何新的 radio 或 checkbox 元素。 输入框标签文本使用小写字母作为属性值。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ assert.deepEqual(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
第一个数组中的所有元素都应按原始顺序添加到第二个数组中。
|
第一个数组中的所有元素都应按原始顺序添加到第二个数组中。 `frankenSplice([1, 2, 3, 4], [], 0)` 应返回 `[1, 2, 3, 4]`。
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);
|
assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);
|
||||||
|
@ -28,7 +28,7 @@ var ourStr = "I come first. " + "I come second.";
|
|||||||
字符串 `I come first. I come second.` 将显示在控制台中。
|
字符串 `I come first. I come second.` 将显示在控制台中。
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
使用 `+` 操作符连接字符串`This is the start.` 和 `This is the end.` 赋值给 `myStr` 。
|
用字符串 `This is the start.` 和 `This is the end.` 通过 `+` 运算符创建 `myStr`。 确保在两个字符串之间包含一个空格。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ ourStr += "I come second.";
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
使用 `+=` 操作符,多行合并字符串 `This is the first sentence.` 和 `This is the second sentence.` ,并赋值给 `myStr` 。 像示例那样使用 `+=` 操作符。 先把第一个字符串赋值给 `myStr`,然后拼接第二个字符串。
|
使用 `+=` 操作符,多行合并字符串 `This is the first sentence.` 和 `This is the second sentence.` ,并赋值给 `myStr` 。 参照示例中显示的方式使用 `+=` 操作符,并确保在两个字符串之间包含一个空格。 先把第一个字符串赋值给 `myStr`,然后拼接第二个字符串。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ dashedName: escape-sequences-in-strings
|
|||||||
|
|
||||||
你需要使用转义字符正确地插入特殊字符。 确保间距与上面文本一致,并且单词或转义字符之间没有空格。
|
你需要使用转义字符正确地插入特殊字符。 确保间距与上面文本一致,并且单词或转义字符之间没有空格。
|
||||||
|
|
||||||
**注意:** `SecondLine` 是因为键入了转义字符(而不是空格),所以在那个位置。
|
**注意:**`SecondLine` 前面的空白是制表符,而不是空格。
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ dashedName: iterate-over-all-properties
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
现在你已经了解了两种属性: <dfn>自身属性</dfn>和 `prototype` 属性。 自身属性是直接在对象上定义的。 而 `prototype` 属性是定义在 `prototype` 上的。
|
现在你已经了解了两种属性: <dfn>自身属性</dfn>和 `prototype` 属性。 自身属性是直接在对象上定义的。 而原型属性在 `prototype` 上定义。
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function Bird(name) {
|
function Bird(name) {
|
||||||
|
@ -11,8 +11,6 @@ dashedName: move-a-relatively-positioned-element-with-css-offsets
|
|||||||
|
|
||||||
Los desplazamientos CSS de `top` o `bottom` y `left` o `right` indican al navegador hasta que punto debe compensar un elemento en relación con el lugar donde se ubicara en el flujo normal del documento. Está compensando un elemento lejos de un punto dado, lo que aleja el elemento del lado al que se hace referencia (efectivamente, en la dirección opuesta). Como viste en el último desafío, usando el desplazamiento `top` movió el `h2` hacia abajo. Del mismo modo, usando un desplazamiento `left` mueve un elemento hacia la derecha.
|
Los desplazamientos CSS de `top` o `bottom` y `left` o `right` indican al navegador hasta que punto debe compensar un elemento en relación con el lugar donde se ubicara en el flujo normal del documento. Está compensando un elemento lejos de un punto dado, lo que aleja el elemento del lado al que se hace referencia (efectivamente, en la dirección opuesta). Como viste en el último desafío, usando el desplazamiento `top` movió el `h2` hacia abajo. Del mismo modo, usando un desplazamiento `left` mueve un elemento hacia la derecha.
|
||||||
|
|
||||||
<img src='https://cdn-media-1.freecodecamp.org/imgr/eWWi3gZ.gif' alt='' />
|
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Utiliza los desplazamientos CSS para mover los `h2` 15 píxeles a la derecha y 10 píxeles hacia arriba.
|
Utiliza los desplazamientos CSS para mover los `h2` 15 píxeles a la derecha y 10 píxeles hacia arriba.
|
||||||
|
@ -28,7 +28,7 @@ var ourStr = "I come first. " + "I come second.";
|
|||||||
La cadena `I come first. I come second.` se mostrará en la consola.
|
La cadena `I come first. I come second.` se mostrará en la consola.
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Construye `myStr` a partir de las cadenas `This is the start.` y `This is the end.` utilizando el operador `+`.
|
Construye `myStr` a partir de las cadenas `This is the start.` y `This is the end.` utilizando el operador `+`. Asegúrate de incluir un espacio entre las dos cadenas.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ ourStr += "I come second.";
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Construye `myStr` en varias líneas concatenando estas dos cadenas: `This is the first sentence.` y `This is the second sentence.` usando el operador `+=`. Utiliza el operador `+=` de forma similar a como se muestra en el editor. Comienza asignando la primera cadena a `myStr`, luego añade la segunda cadena.
|
Construye `myStr` en varias líneas concatenando estas dos cadenas: `This is the first sentence.` y `This is the second sentence.` usando el operador `+=`. Utiliza el operador `+=` similar a como se muestra en el ejemplo y asegúrate de incluir un espacio entre las dos cadenas. Comienza asignando la primera cadena a `myStr`, luego añade la segunda cadena.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
|
@ -8,27 +8,25 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Habrás notado que algunos desafíos de JavaScript de freeCodeCamp incluyen su propia consola. Esta consola se comporta un poco diferente a la consola del navegador que utilizaste en el último desafío.
|
Habrás notado que algunos desafíos de freeCodeCamp tienen su propia consola. Esta consola se comporta un poco diferente a la consola del navegador.
|
||||||
|
|
||||||
El siguiente desafío pretende destacar la principal diferencia entre la consola de freeCodeCamp y la de tu navegador.
|
Hay muchos métodos para usar con `console` para mostrar mensajes. `log`, `warn` y `clear` para nombrar algunos. La consola de freeCodeCamp solamente mostrará mensajes de tipo `log`, mientras que la consola del navegador mostrará todos los mensajes. Cuando hagas cambios a tu código, se ejecutara automáticamente y mostrará los registros. La consola de freeCodeCamp se borra cada vez que ejecutas tu código.
|
||||||
|
|
||||||
Cuando se ejecuta JavaScript ordinario, la consola del navegador mostrará sus declaraciones `console.log()` el número exacto de veces que se llama.
|
|
||||||
|
|
||||||
La consola de freeCodeCamp imprimirá sus declaraciones `console.log()` poco después de que el editor detecte un cambio en el script, así como durante las pruebas.
|
|
||||||
|
|
||||||
La consola de freeCodeCamp se borra antes de que se ejecuten las pruebas y, para evitar el spam, sólo imprime los registros durante la primera prueba (véase la nota siguiente para las excepciones).
|
|
||||||
|
|
||||||
Si quieres ver todos los registros de cada prueba, ejecuta las pruebas y abre la consola del navegador. Si prefieres usar la consola del navegador, y quieres que imite la consola de freeCodeCamp, coloca `console.clear()` antes de cualquier otra llamada a `console`, para limpiar la consola del navegador.
|
|
||||||
|
|
||||||
**Nota: ** las funciones internas de `console.log` se imprimen en la consola de freeCodeCamp siempre que se llaman. Esto puede ayudar a depurar funciones que se llaman durante la prueba.
|
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Primero, usa `console.log` para imprimir la variable `output`. Luego, usa `console.clear` para limpiar la consola del navegador.
|
Primero, abre tu consola del navegador para que puedas ver los registros. Para hacer eso, puedes hacer clic derecho en la barra de navegación superior de freeCodeCamp y seleccionar `inspect` en la mayoría de los navegadores. Luego busca la pestaña `console` en la ventana que se abra.
|
||||||
|
|
||||||
|
Después, utiliza `console.log` para mostrar la variable `output`. Ve ambas consolas para ver los registros. Finalmente, utiliza `console.clear` luego de tu registro para borrar la consola del navegador. Ve la diferencia entre las dos consolas.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Debes utilizar `console.clear()` para limpiar la consola del navegador.
|
Debes utilizar `console.log()` para imprimir la variable `output`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
|
||||||
|
```
|
||||||
|
|
||||||
|
Debes utilizar `console.clear()` para borrar la consola del navegador.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -38,10 +36,14 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Debes utilizar `console.log()` para imprimir la variable `output`.
|
Debes borrar la consola luego de tu registro.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
|
assert(
|
||||||
|
__helpers
|
||||||
|
.removeWhiteSpace(code)
|
||||||
|
.match(/console\.log\(output\)[\s\S]*console.clear\(\)/)
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -49,25 +51,15 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Open your browser console.
|
let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";
|
||||||
let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";
|
|
||||||
// Use console.log() to print the output variable.
|
|
||||||
|
|
||||||
// Run the tests to see the difference between the two consoles.
|
|
||||||
|
|
||||||
// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Open your browser console.
|
let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";
|
||||||
let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";
|
|
||||||
// Use console.log() to print the output variable.
|
|
||||||
console.clear();
|
|
||||||
console.log(output);
|
console.log(output);
|
||||||
|
console.clear();
|
||||||
// Run the tests to see the difference between the two consoles.
|
|
||||||
|
|
||||||
// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.
|
|
||||||
```
|
```
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348bd9aec908849
|
id: bad87fee1348bd9aec908849
|
||||||
title: Agregar elementos dentro de tus recursos de Bootstrap
|
title: Agrega elementos dentro de tus recursos de Bootstrap
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16636
|
forumTopicId: 16636
|
||||||
dashedName: add-elements-within-your-bootstrap-wells
|
dashedName: add-elements-within-your-bootstrap-wells
|
||||||
@ -8,13 +8,13 @@ dashedName: add-elements-within-your-bootstrap-wells
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Ahora estamos a varios elementos `div` de profundidad en cada columna de nuestras filas. Esto es todo lo que necesitamos. Ahora podemos agregar nuestros elementos `button`.
|
Ahora estamos a varios elementos `div` de profundidad en cada columna de nuestra fila. Esto es lo más profundo que necesitaremos ir. Ahora podemos agregar nuestros elementos `button`.
|
||||||
|
|
||||||
Anida tres elementos `button` dentro de cada uno de los elementos `div` que posean una clase `well`.
|
Anida tres elementos `button` dentro de cada uno de los elementos `div` que posean una clase `well`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Tres elementos `button` deberían ser insertados dentro de cada uno de los elementos `div` con la clase `well`.
|
Tres elementos `button` deben estar anidados dentro de cada uno de tus elementos `div` con la clase `well`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -23,13 +23,13 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Debería haber un total de 6 elementos `button`.
|
Debes tener un total de 6 elementos `button`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('button') && $('button').length > 5);
|
assert($('button') && $('button').length > 5);
|
||||||
```
|
```
|
||||||
|
|
||||||
Todos los elementos `button` deben tener etiqueta de cierre.
|
Todos tus elementos `button` deben tener etiquetas de cierre.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348bd9aedc08845
|
id: bad87fee1348bd9aedc08845
|
||||||
title: Agrega íconos Font Awesome a todos nuestros botones
|
title: Agrega iconos Font Awesome a todos nuestros botones
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16637
|
forumTopicId: 16637
|
||||||
required:
|
required:
|
||||||
@ -12,17 +12,17 @@ dashedName: add-font-awesome-icons-to-all-of-our-buttons
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Font Awesome es una conveniente librería de íconos. Éstos pueden ser fuentes de la web o gráficos vectoriales. Los iconos son tratados como fuentes. Puedes especificar su tamaño usando píxeles y ellos asumirán el tamaño de fuente de su elemento HTML padre.
|
Font Awesome es una conveniente librería de iconos. Estos pueden ser fuentes web o gráficos vectoriales. Estos iconos son tratados como fuentes. Puedes especificar su tamaño usando píxeles, y ellos asumirán el tamaño de fuente de su elemento HTML padre.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Utiliza Font Awesome para agregar un icono `info-circle` a su botón info y un icono `trash` al botón borrar.
|
Utiliza Font Awesome para agregar un icono `info-circle` a su botón info y un icono `trash` al botón borrar.
|
||||||
|
|
||||||
** Nota: **El elemento `span` es una alternativa aceptable al elemento `i` para las direcciones a continuación.
|
**Nota:**El elemento `span` es una alternativa aceptable al elemento `i` para las direcciones a continuación.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Deberías añadir un elemento `<i class="fas fa-info-circle"></i>` dentro de tu elemento `info` botón info.
|
Debes añadir un elemento `<i class="fas fa-info-circle"></i>` dentro de tu elemento botón `info`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -31,7 +31,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Deberías añadir un elemento `<i class="fas fa-trash"></i>` dentro de tu elemento botón `delete`.
|
Debes añadir un elemento `<i class="fas fa-trash"></i>` dentro de tu elemento botón `delete`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -40,7 +40,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Cada uno de tus elementos `i` debe tener una etiqueta de cierre y `<i class="fas fa-thumbs-up"></i>` tiene que estar en el botón `like`.
|
Cada uno de tus elementos `i` debe tener una etiqueta de cierre y `<i class="fas fa-thumbs-up"></i>` tiene que estar en tu elemento botón `like`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348bd9aedd08845
|
id: bad87fee1348bd9aedd08845
|
||||||
title: Agrega íconos Font Awesome a nuestros botones
|
title: Agrega iconos Font Awesome a nuestros botones
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16638
|
forumTopicId: 16638
|
||||||
required:
|
required:
|
||||||
@ -12,7 +12,7 @@ dashedName: add-font-awesome-icons-to-our-buttons
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Font Awesome es una librería de iconos muy conveniente. Estos iconos pueden ser fuentes web o gráficos vectoriales. Estos iconos son tratados como fuentes. Puedes especificar su tamaño usando píxeles, y ellos asumirán el tamaño de fuente de su elemento HTML padre.
|
Font Awesome es una conveniente librería de iconos. Estos iconos pueden ser fuentes web o gráficos vectoriales. Estos iconos son tratados como fuentes. Puedes especificar su tamaño usando píxeles, y ellos asumirán el tamaño de fuente de su elemento HTML padre.
|
||||||
|
|
||||||
Puedes incluir Font Awesome en cualquier aplicación agregando el siguiente código al principio de tu HTML:
|
Puedes incluir Font Awesome en cualquier aplicación agregando el siguiente código al principio de tu HTML:
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ Puedes incluir Font Awesome en cualquier aplicación agregando el siguiente cód
|
|||||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||||
```
|
```
|
||||||
|
|
||||||
En este caso, ya lo hemos añadido por ti en esta página detrás de escena.
|
En este caso, ya lo hemos añadido por ti en esta página tras bambalinas.
|
||||||
|
|
||||||
El elemento `i` fue originalmente usado para crear elementos itálicos, pero ahora es comúnmente usado para iconos. Puedes añadir las clases de Font Awesome al elemento `i` para convertirlo en un icono, por ejemplo:
|
El elemento `i` fue originalmente usado para crear elementos itálicos, pero ahora es comúnmente usado para iconos. Puedes añadir las clases de Font Awesome al elemento `i` para convertirlo en un icono, por ejemplo:
|
||||||
|
|
||||||
@ -28,11 +28,11 @@ El elemento `i` fue originalmente usado para crear elementos itálicos, pero aho
|
|||||||
<i class="fas fa-info-circle"></i>
|
<i class="fas fa-info-circle"></i>
|
||||||
```
|
```
|
||||||
|
|
||||||
Ten en cuenta que el elemento `span` también es aceptable para usar con íconos.
|
Ten en cuenta que el elemento `span` también es aceptable para usar con iconos.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Usa Font Awesome para añadir un icono `thumbs-up` a tu botón de "Like", dandole un elemento `i` con las clases `fas` y `fa-thumbs-up`. Asegúrate de dejar el texto `Like` junto al icono.
|
Usa Font Awesome para añadir un icono `thumbs-up` a tu botón de "Like", dándole un elemento `i` con las clases `fas` y `fa-thumbs-up`. Asegúrate de dejar el texto `Like` junto al icono.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ Debes añadir un elemento `i` con las clases `fas` y `fa-thumbs-up`.
|
|||||||
assert($('i').is('.fas.fa-thumbs-up') || $('span').is('.fas.fa-thumbs-up'));
|
assert($('i').is('.fas.fa-thumbs-up') || $('span').is('.fas.fa-thumbs-up'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu ícono `fa-thumbs-up` debe estar ubicado dentro del botón "Like".
|
Tu icono `fa-thumbs-up` debe estar ubicado dentro del botón "Like".
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -62,7 +62,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu ícono debe tener una etiqueta de cierre.
|
Tu elemento icono debe tener una etiqueta de cierre.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(code.match(/<\/i>|<\/span>/g));
|
assert(code.match(/<\/i>|<\/span>/g));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348bd9aec908853
|
id: bad87fee1348bd9aec908853
|
||||||
title: Añade atributos de identificación a elementos de Bootstrap
|
title: Añade atributos de "id" a elementos de Bootstrap
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16639
|
forumTopicId: 16639
|
||||||
dashedName: add-id-attributes-to-bootstrap-elements
|
dashedName: add-id-attributes-to-bootstrap-elements
|
||||||
@ -8,11 +8,11 @@ dashedName: add-id-attributes-to-bootstrap-elements
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Recuerda que además de los atributos de clase, puedes darle a cada elemento un atributo `id`.
|
Recuerda que además de los atributos de clase, puedes darle a cada uno de tus elementos un atributo `id`.
|
||||||
|
|
||||||
Cada "id" debe ser único en un elemento específico y utilizarse una sola vez por página.
|
Cada "id" debe ser único en un elemento específico y utilizarse una sola vez por página.
|
||||||
|
|
||||||
Vamos a dar un "id" único a cada uno de nuestros elementos `div` de la clase `well`.
|
Vamos a dar un "id" único a cada uno de nuestros elementos `div` con la clase `well`.
|
||||||
|
|
||||||
Recuerda que puedes dar un "id" a un elemento de esta manera:
|
Recuerda que puedes dar un "id" a un elemento de esta manera:
|
||||||
|
|
||||||
@ -20,11 +20,11 @@ Recuerda que puedes dar un "id" a un elemento de esta manera:
|
|||||||
<div class="well" id="center-well">
|
<div class="well" id="center-well">
|
||||||
```
|
```
|
||||||
|
|
||||||
Agrega el "id" `left-well` al elemento de la izquierda de la clase "well". Agrega el "id" `right-well` al elemento de la derecha de la clase "well".
|
Agrega el "id" `left-well` al elemento de la izquierda con la clase "well". Agrega el "id" `right-well` al elemento de la derecha con la clase "well".
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
El elemento de la izquierda de la clase `well` deberá tener el "id" `left-well`.
|
El elemento de la izquierda con la clase `well` debe tener el "id" `left-well`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -33,7 +33,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
El elemento de la derecha de la clase `well` deberá tener el "id" `right-well`.
|
El elemento de la derecha con la clase `well` debe tener el "id" `right-well`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -8,7 +8,7 @@ dashedName: call-out-optional-actions-with-btn-info
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Bootstrap viene con diferentes colores predefinidos para botones. La clase `btn-info` se utiliza para llamar la atención sobre las acciones opcionales que el usuario puede realizar.
|
Bootstrap viene con varios colores predefinidos para los botones. La clase `btn-info` se utiliza para llamar la atención sobre las acciones opcionales que el usuario puede realizar.
|
||||||
|
|
||||||
Crea un nuevo botón de Bootstrap debajo de tu botón `Like` con el texto `Info` y añádele las clases de Bootstrap `btn-info` y `btn-block`.
|
Crea un nuevo botón de Bootstrap debajo de tu botón `Like` con el texto `Info` y añádele las clases de Bootstrap `btn-info` y `btn-block`.
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ Debes crear un nuevo elemento `button` con el texto `Info`.
|
|||||||
assert(new RegExp('info', 'gi').test($('button').text()));
|
assert(new RegExp('info', 'gi').test($('button').text()));
|
||||||
```
|
```
|
||||||
|
|
||||||
Ambos botones deben tener las clases `btn` y `btn-block`.
|
Tus dos botones de Bootstrap deben tener las clases `btn` y `btn-block`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('button.btn-block.btn').length > 1);
|
assert($('button.btn-block.btn').length > 1);
|
||||||
|
@ -8,9 +8,9 @@ dashedName: center-text-with-bootstrap
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Ahora que estamos usando Bootstrap, podemos centrar el encabezado para que luzca mejor. Todo lo que necesitamos hacer es añadir la clase `text-center` a nuestro elemento `h2`.
|
Ahora que estamos usando Bootstrap, podemos centrar nuestro encabezado para que luzca mejor. Lo único que necesitamos hacer es agregar la clase `text-center` a nuestro elemento `h2`.
|
||||||
|
|
||||||
Recuerda que puedes añadir varias clases al mismo elemento separando cada una de ellas con un espacio:
|
Recuerda que puedes agregar varias clases al mismo elemento separando cada una de ellas con un espacio, de la siguiente manera:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<h2 class="red-text text-center">your text</h2>
|
<h2 class="red-text text-center">your text</h2>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348cd8acef08812
|
id: bad87fee1348cd8acef08812
|
||||||
title: Crear un botón Bootstrap como elemento de bloque
|
title: Crea un botón Bootstrap como elemento de bloque
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16810
|
forumTopicId: 16810
|
||||||
dashedName: create-a-block-element-bootstrap-button
|
dashedName: create-a-block-element-bootstrap-button
|
||||||
@ -8,7 +8,7 @@ dashedName: create-a-block-element-bootstrap-button
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Normalmente, tus elementos `button` con las clases `btn` y `btn-default` son tan anchos como el texto que contienen. Por ejemplo:
|
Normalmente, tus elementos `button` con las clases `btn` y `btn-default` son tan anchos como el texto que los contiene. Por ejemplo:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<button class="btn btn-default">Submit</button>
|
<button class="btn btn-default">Submit</button>
|
||||||
@ -16,9 +16,9 @@ Normalmente, tus elementos `button` con las clases `btn` y `btn-default` son tan
|
|||||||
|
|
||||||
Este botón será tan ancho como la palabra `Submit`.
|
Este botón será tan ancho como la palabra `Submit`.
|
||||||
|
|
||||||
<button class='btn btn-default'>Enviar</button>
|
<button class='btn btn-default'>Submit</button>
|
||||||
|
|
||||||
Al hacer los elementos de bloque con la clase `btn-block`, tu botón ocupará el ancho horizontal de la página y cualquier elemento que lo siga se posicionará en una "nueva línea" debajo del bloque.
|
Al convertirlos en elementos de bloque con la clase adicional `btn-block`, tu botón se estirará para llenar completamente el espacio horizontal de tu página y cualquier elemento siguiente se posicionará en una "nueva línea" debajo del bloque.
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<button class="btn btn-default btn-block">Submit</button>
|
<button class="btn btn-default btn-block">Submit</button>
|
||||||
@ -26,27 +26,27 @@ Al hacer los elementos de bloque con la clase `btn-block`, tu botón ocupará el
|
|||||||
|
|
||||||
Este botón tomará el 100% del ancho disponible.
|
Este botón tomará el 100% del ancho disponible.
|
||||||
|
|
||||||
<button class='btn btn-default btn-block'>Enviar</button>
|
<button class='btn btn-default btn-block'>Submit</button>
|
||||||
|
|
||||||
Ten en cuenta que estos botones aún necesitan la clase `btn`.
|
Ten en cuenta que estos botones aún necesitan la clase `btn`.
|
||||||
|
|
||||||
Añade la clase `btn-block` a tu botón Bootstrap.
|
Agrega la clase de Bootstrap `btn-block` a tu botón de Bootstrap.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Tu botón debe contener las clases `btn` y `btn-default`.
|
Tu botón debe conservar las clases `btn` y `btn-default`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('button').hasClass('btn') && $('button').hasClass('btn-default'));
|
assert($('button').hasClass('btn') && $('button').hasClass('btn-default'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu botón debe contener la clase `btn-block`.
|
Tu botón debe conservar la clase `btn-block`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('button').hasClass('btn-block'));
|
assert($('button').hasClass('btn-block'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Todos tu elementos `button` deben tener etiquetas de cierre.
|
Todos tus elementos `button` deben tener etiquetas de cierre.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -8,7 +8,7 @@ dashedName: create-a-bootstrap-button
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Bootstrap tiene sus propios estilos para los elementos `button`, que se ven mucho mejor que el HTML plano.
|
Bootstrap tiene sus propios estilos para los elementos `button`, que se ven mucho mejor que los de HTML puro.
|
||||||
|
|
||||||
Crea un nuevo elemento `button` debajo de la foto grande de tu gatito. Dale las clases `btn` y `btn-default`, así como el texto de `Like`.
|
Crea un nuevo elemento `button` debajo de la foto grande de tu gatito. Dale las clases `btn` y `btn-default`, así como el texto de `Like`.
|
||||||
|
|
||||||
@ -23,13 +23,13 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu nuevo botón debería tener dos clases: `btn` y `btn-default`.
|
Tu nuevo botón debe tener dos clases: `btn` y `btn-default`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('button').hasClass('btn') && $('button').hasClass('btn-default'));
|
assert($('button').hasClass('btn') && $('button').hasClass('btn-default'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Todos los elementos `button` deben tener etiquetas de cierre.
|
Todos los elementos de tu `button` deben tener etiquetas de cierre.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348bd9aec908846
|
id: bad87fee1348bd9aec908846
|
||||||
title: Crear un encabezado de Bootstrap
|
title: Crea un encabezado de Bootstrap
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16812
|
forumTopicId: 16812
|
||||||
dashedName: create-a-bootstrap-headline
|
dashedName: create-a-bootstrap-headline
|
||||||
@ -34,7 +34,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu elemento `h3` debe estar coloreado al aplicar la clase `text-primary`
|
Tu elemento `h3` debe ser coloreado aplicando la clase `text-primary`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('h3').hasClass('text-primary'));
|
assert($('h3').hasClass('text-primary'));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1348bd9aec908852
|
id: bad87fee1348bd9aec908852
|
||||||
title: Crear una clase para apuntar con selectores jQuery
|
title: Crear una clase para seleccionar con selectores jQuery
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 16815
|
forumTopicId: 16815
|
||||||
dashedName: create-a-class-to-target-with-jquery-selectors
|
dashedName: create-a-class-to-target-with-jquery-selectors
|
||||||
@ -8,7 +8,7 @@ dashedName: create-a-class-to-target-with-jquery-selectors
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
No todas las clases necesitan tener CSS correspondientes. A veces creamos clases sólo con el propósito de seleccionar aquellos elementos más fácilmente utilizando jQuery.
|
No es necesario que todas las clases tengan su correspondiente CSS. A veces creamos clases sólo con el propósito de seleccionar aquellos elementos más fácilmente utilizando jQuery.
|
||||||
|
|
||||||
Dale a cada uno de tus elementos `button` la clase `target`.
|
Dale a cada uno de tus elementos `button` la clase `target`.
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@ dashedName: create-a-custom-heading
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Crearemos un título simple para nuestra aplicación de fotos de gatos colocando el título y la imagen relajante del gato en la misma fila.
|
Haremos un encabezado simple para nuestro 'Cat Photo App' colocando el título y la imagen del gato relajándose en la misma fila.
|
||||||
|
|
||||||
Recuerda, Bootstrap usa un sistema de cuadrícula responsivo, lo que facilita la colocación de elementos en filas y especifica el ancho relativo de cada elemento. La mayoría de las clases de Bootstrap se pueden aplicar a un elemento `div`.
|
Recuerda que Bootcamp utiliza un sistema de cuadrícula responsivo, el cual hace más fácil poner elementos en filas y especificar el ancho relativo de cada elemento. La mayoría de las clases de Bootstrap pueden ser aplicadas a un elemento `div`.
|
||||||
|
|
||||||
Anida tu primera imagen y tu elemento `h2` dentro de un solo elemento `<div class="row">`. Anida tu elemento `h2` dentro de un `<div class="col-xs-8">` y tu imagen en un `<div class="col-xs-4">` de modo que estén en la misma línea.
|
Anida tu primera imagen y tu elemento `h2` dentro de un solo elemento `<div class="row">`. Anida tu elemento `h2` dentro de `<div class="col-xs-8">` y tu imagen en un `<div class="col-xs-4">` para que estén en la misma línea.
|
||||||
|
|
||||||
¿Observas cómo la imagen ahora tiene el tamaño adecuado para ajustarse al texto?
|
¿Observas cómo la imagen ahora tiene el tamaño adecuado para ajustarse al texto?
|
||||||
|
|
||||||
|
@ -8,25 +8,25 @@ dashedName: create-bootstrap-wells
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Bootstrap tiene una clase llamada `well` (pozo) que puede crear una ilusión visual de profundidad en las columnas.
|
Bootstrap tiene una clase llamada `well` que puede crear una sensación visual de profundidad en tus columnas.
|
||||||
|
|
||||||
Incrusta un elemento `div` con la clase `well` en cada uno de los elementos `col-xs-6` y `div`.
|
Anida un elemento `div` con la clase `well` dentro de cada uno de tus elementos `col-xs-6` `div`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Debes añadir un elemento `div` con la clase `well` dentro de cada uno de los elementos `div` con la clase `col-xs-6`
|
Debes añadir un elemento `div` con la clase `well` dentro de cada uno de tus elementos `div` con la clase `col-xs-6`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('div.col-xs-6').not(':has(>div.well)').length < 1);
|
assert($('div.col-xs-6').not(':has(>div.well)').length < 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
Ambos elementos `div` con la clase `col-xs-6` deben estar incrustados en el elemento `div` con la clase `row`.
|
Ambos de tus elementos `div` con la clase `col-xs-6` deben estar anidados dentro de tu elemento `div` con la clase `row`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('div.row > div.col-xs-6').length > 1);
|
assert($('div.row > div.col-xs-6').length > 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
Todos los elementos `div` deben tener etiquetas de cierre.
|
Todos tus elementos `div` deben tener etiquetas de cierre.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: bad87fee1347bd9aedf08845
|
id: bad87fee1347bd9aedf08845
|
||||||
title: Deja de lado el CSS personalizado por Bootstrap
|
title: Adiós CSS Personalizado. Hola Bootstrap
|
||||||
challengeType: 0
|
challengeType: 0
|
||||||
forumTopicId: 17565
|
forumTopicId: 17565
|
||||||
dashedName: ditch-custom-css-for-bootstrap
|
dashedName: ditch-custom-css-for-bootstrap
|
||||||
@ -8,31 +8,31 @@ dashedName: ditch-custom-css-for-bootstrap
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Podemos limpiar nuestro código y hacer que nuestra aplicación de fotos de gatos parezca más convencional, usando los estilos incorporados de Bootstrap, en lugar de los estilos personalizados que hemos creado antes.
|
Podemos limpiar nuestro código y hacer que nuestro 'Cat Photo App' se vea más convencional utilizando los estilos incorporados de Bootstrap en lugar de los estilos personalizados que creamos antes.
|
||||||
|
|
||||||
No te preocupes – tendremos mucho tiempo para personalizar nuestro CSS más adelante.
|
No te preocupes - habrá mucho tiempo para personalizar nuestro CSS después.
|
||||||
|
|
||||||
Elimina las declaraciones de CSS `.red-text`, `p` y `.smaller-image` de tu elemento `style` para que la únicas declaraciones que queden en tu elemento `style` sean `h2` y `thick-green-border`.
|
Borra las declaraciones de CSS `.red-text`, `p` y `.smaller-image` de tu elemento `style` para que las únicas declaraciones en tu elemento `style` sean `h2` y `thick-green-border`.
|
||||||
|
|
||||||
A continuación elimina el elemento `p` que contiene un enlace roto. Después elimina la clase `red-text` de tu elemento `h2` y reemplázala con la clase `text-primary` de Bootstrap.
|
Luego, borra el elemento `p` que contiene un enlace muerto. Después, borra la clase `red-text` de tu elemento `h2` y reemplázalo con la clase de Bootstrap `text-primary`.
|
||||||
|
|
||||||
Finalmente elimina la clase `smaller-image` de tu primer elemento `img` y reemplázala con la clase `img-responsive`.
|
Finalmente, remueve la clase `smaller-image` de tu primer elemento `img` y reemplázalo con la clase `img-responsive`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Tu elemento `h2` ya no debería incluir la clase `red-text`.
|
Tu elemento `h2` ya no debe tener la clase `red-text`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(!$('h2').hasClass('red-text'));
|
assert(!$('h2').hasClass('red-text'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu elemento `h2` ahora debe incluir la clase `text-primary`.
|
Tu elemento `h2` ahora debe tener la clase `text-primary`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert($('h2').hasClass('text-primary'));
|
assert($('h2').hasClass('text-primary'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Tus elementos p (párrafo) ya no deben usar la fuente `Monospace`.
|
Tus elementos de párrafo ya no deben usar la fuente `Monospace`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -42,7 +42,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
La clase `smaller-image` debe ser eliminada de tu imagen superior.
|
La clase `smaller-image` debe ser removida de tu imagen superior.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(!$('img').hasClass('smaller-image'));
|
assert(!$('img').hasClass('smaller-image'));
|
||||||
|
@ -22,7 +22,7 @@ Segui <a href='https://www.freecodecamp.org/news/get-started-with-mongodb-atlas/
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Aggiungi `mongodb` e `mongoose` al `package.json` del progetto. Poi, richiedi mongoose come `mongoose` in `myApp.js`. Crea un file `.env` e aggiungi una variabile `MONGO_URI` ad esso. Il suo valore dovrebbe essere l'URI del database MongoDB Atlas. Assicurati di racchiudere l'URI tra virgolette singole o doppie, e ricorda che non puoi usare spazi attorno al segno `=` nelle variabili d'ambiente. Ad esempio, `MONGO_URI='VALUE'`. Quando hai finito, connettiti al database usando la seguente sintassi:
|
Aggiungi `mongodb@~3.6.0` e `mongoose@~5.4.0` al `package.json` del progetto. Poi, richiedi mongoose come `mongoose` in `myApp.js`. Crea un file `.env` e aggiungi una variabile `MONGO_URI` ad esso. Il suo valore dovrebbe essere l'URI del database MongoDB Atlas. Assicurati di racchiudere l'URI tra virgolette singole o doppie, e ricorda che non puoi usare spazi attorno al segno `=` nelle variabili d'ambiente. Ad esempio, `MONGO_URI='VALUE'`. Quando hai finito, connettiti al database usando la seguente sintassi:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
|
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||||
|
@ -9,7 +9,7 @@ dashedName: comparison-with-the-greater-than-or-equal-to-operator
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
O operador maior ou igual que (`>`) compara os valores de dois números. Se o número à esquerda é maior ou igual ao número à direita, ele retorna `true`. Caso contrário, ele retornará `false`.
|
O operador maior ou igual que (`>=`) compara os valores de dois números. Se o número à esquerda é maior ou igual ao número à direita, ele retorna `true`. Caso contrário, ele retornará `false`.
|
||||||
|
|
||||||
Tal como o operador de igualdade, o operador maior que converterá os tipos de dados de valores enquanto compara.
|
Tal como o operador de igualdade, o operador maior que converterá os tipos de dados de valores enquanto compara.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ dashedName: comparison-with-the-strict-inequality-operator
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
O operador de desigualdade estrito (`!=`) é o oposto lógico do operador de igualdade estrito. Significa que "não é estritamente igual" e retorna `false` onde a igualdade estrita retornaria `true` e *vice-versa*. O operador de desigualdade estrita não converterá tipos de dados.
|
O operador de desigualdade estrito (`!==`) é o oposto lógico do operador de igualdade estrito. Significa que "não é estritamente igual" e retorna `false` onde a igualdade estrita retornaria `true` e *vice-versa*. O operador de desigualdade estrita não converterá tipos de dados.
|
||||||
|
|
||||||
**Exemplos**
|
**Exemplos**
|
||||||
|
|
||||||
|
@ -8,27 +8,25 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Você pode ter percebido que alguns dos desafios de JavaScript da freeCodeCamp incluem seu próprio console. Esse console se comporta um pouco diferente do console do navegador que você utilizou no último desafio.
|
Você pode ter percebido que alguns dos desafios do freeCodeCamp incluem seu próprio console. Este console se comporta um pouco diferente do console do navegador.
|
||||||
|
|
||||||
O desafio a seguir tem a finalidade de destacar a principal diferença entre o console do freeCodeCamp e do navegador.
|
Existem muitos métodos para usar no `console` para exibir mensagens. `log`, `warn` e `clear` são alguns deles. O console do freeCodeCamp só produzirá mensagens de `log`. Já o console do navegador mostrará todas as mensagens. Quando você fizer alterações em seu código, ele será executado e mostrará automaticamente os logs. O console do freeCodeCamp é limpo cada vez que o código é executado.
|
||||||
|
|
||||||
Quando você executa JavaScript comum, o console do navegado exibirá suas instruções `console.log()` a exata quantidade de vezes que é chamada.
|
|
||||||
|
|
||||||
O console do freeCodeCamp irá imprimir suas instruções `console.log()` um curto período depois do editor detectar mudança no script, e também durante o teste.
|
|
||||||
|
|
||||||
O console do freeCodeCamp é apagado antes de cada execução de testes e, para evitar spam, só imprime os logs durante o primeiro teste (veja a nota abaixo para exceções).
|
|
||||||
|
|
||||||
Se você gostaria de ver todos os logs em todos os testes, execute os testes e abra o console do navegador. Se preferir usar o console do navegador e quiser que ele imite o console do freeCodeCamp, coloque `console.clear()` antes de qualquer outra chamada ao `console`, para apagar o console do navegador.
|
|
||||||
|
|
||||||
**Observação:** `console.log` dentro de funções é impresso no console do freeCodeCamp toda vez que essas funções forem chamadas. Isso pode ajudar a depurar (ou debugar) funções que são chamadas durante os testes.
|
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Primeiro, use `console.log` para exibir a variável `output`. Em seguida, use `console.clear` para apagar o console do navegador.
|
Primeiro, abra o console do navegador para poder ver os registros (logs). Para fazer isso, clique com o botão direito na barra de navegação do freeCodeCamp, na parte superior, e clique em `inspect` na maioria dos navegadores. Em seguida, encontre a aba `console` na janela que é aberta.
|
||||||
|
|
||||||
|
Depois disso, use `console.log` para registrar a variável `output`. Veja os dois consoles para ver o log. Por fim, use `console.clear` depois do registro para limpar o console do navegador. Veja a diferença entre os dois consoles.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Você deve usar `console.clear()` para apagar o console do navegador.
|
Você deve usar `console.log()` para imprimir a variável `output`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
|
||||||
|
```
|
||||||
|
|
||||||
|
Você deve usar `console.clear()` para limpar o console do navegador.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -38,10 +36,14 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Você deve usar `console.log()` para imprimir a variável `output`.
|
Você deve limpar o console após o registro (log).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
|
assert(
|
||||||
|
__helpers
|
||||||
|
.removeWhiteSpace(code)
|
||||||
|
.match(/console\.log\(output\)[\s\S]*console.clear\(\)/)
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -49,25 +51,15 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Open your browser console.
|
let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";
|
||||||
let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";
|
|
||||||
// Use console.log() to print the output variable.
|
|
||||||
|
|
||||||
// Run the tests to see the difference between the two consoles.
|
|
||||||
|
|
||||||
// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Open your browser console.
|
let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";
|
||||||
let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";
|
|
||||||
// Use console.log() to print the output variable.
|
|
||||||
console.clear();
|
|
||||||
console.log(output);
|
console.log(output);
|
||||||
|
console.clear();
|
||||||
// Run the tests to see the difference between the two consoles.
|
|
||||||
|
|
||||||
// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.
|
|
||||||
```
|
```
|
||||||
|
@ -22,7 +22,7 @@ Siga <a href='https://www.freecodecamp.org/news/get-started-with-mongodb-atlas/'
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Adicione `mongodb` e `mongoose` ao `package.json` do projeto. Depois, solicite o mongoose como `mongoose` no `myApp.js`. Crie um arquivo `.env` e adicione uma variável `MONGO_URI` a ele. Esse valor deve ser o URI de banco de dados do MongoDB Atlas. Não se esqueça de cercar o URI com aspas simples ou duplas. Lembre-se de que você não pode usar espaços ao redor de `=` em variáveis de ambiente. Por exemplo, `MONGO_URI='VALUE'`. Quando terminar, conecte-se ao banco de dados utilizando a seguinte sintaxe:
|
Adicione `mongodb@~3.6.0` e `mongoose@~5.4.0` ao `package.json` do projeto. Depois, solicite o mongoose como `mongoose` no `myApp.js`. Crie um arquivo `.env` e adicione uma variável `MONGO_URI` a ele. Esse valor deve ser o URI de banco de dados do MongoDB Atlas. Não se esqueça de cercar o URI com aspas simples ou duplas. Lembre-se de que você não pode usar espaços ao redor de `=` em variáveis de ambiente. Por exemplo, `MONGO_URI='VALUE'`. Quando terminar, conecte-se ao banco de dados utilizando a seguinte sintaxe:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
|
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||||
|
@ -133,20 +133,28 @@ var MaxHeap = function() {
|
|||||||
```js
|
```js
|
||||||
var MaxHeap = function() {
|
var MaxHeap = function() {
|
||||||
// Only change code below this line
|
// Only change code below this line
|
||||||
this.heap = [null];
|
this.heap = [];
|
||||||
this.insert = (ele) => {
|
this.parent = index => {
|
||||||
var index = this.heap.length;
|
return Math.floor((index - 1) / 2);
|
||||||
var arr = [...this.heap];
|
}
|
||||||
arr.push(ele);
|
this.insert = element => {
|
||||||
while (ele > arr[Math.floor(index / 2)] && index > 1) {
|
this.heap.push(element);
|
||||||
arr[index] = arr[Math.floor(index / 2)];
|
this.heapifyUp(this.heap.length - 1);
|
||||||
arr[Math.floor(index / 2)] = ele;
|
}
|
||||||
index = arr[Math.floor(index / 2)];
|
this.heapifyUp = index => {
|
||||||
}
|
let currentIndex = index,
|
||||||
this.heap = arr;
|
parentIndex = this.parent(currentIndex);
|
||||||
|
while (currentIndex > 0 && this.heap[currentIndex] > this.heap[parentIndex]) {
|
||||||
|
this.swap(currentIndex, parentIndex);
|
||||||
|
currentIndex = parentIndex;
|
||||||
|
parentIndex = this.parent(parentIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.swap = (index1, index2) => {
|
||||||
|
[this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]];
|
||||||
}
|
}
|
||||||
this.print = () => {
|
this.print = () => {
|
||||||
return this.heap.slice(1);
|
return this.heap;
|
||||||
}
|
}
|
||||||
// Only change code above this line
|
// Only change code above this line
|
||||||
};
|
};
|
||||||
|
@ -114,21 +114,29 @@ assert(
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var MaxHeap = function() {
|
var MaxHeap = function () {
|
||||||
this.heap = [null];
|
this.heap = [];
|
||||||
this.insert = (ele) => {
|
this.parent = index => {
|
||||||
var index = this.heap.length;
|
return Math.floor((index - 1) / 2);
|
||||||
var arr = [...this.heap];
|
}
|
||||||
arr.push(ele);
|
this.insert = element => {
|
||||||
while (ele > arr[Math.floor(index / 2)] && index > 1) {
|
this.heap.push(element);
|
||||||
arr[index] = arr[Math.floor(index / 2)];
|
this.heapifyUp(this.heap.length - 1);
|
||||||
arr[Math.floor(index / 2)] = ele;
|
}
|
||||||
index = arr[Math.floor(index / 2)];
|
this.heapifyUp = index => {
|
||||||
|
let currentIndex = index,
|
||||||
|
parentIndex = this.parent(currentIndex);
|
||||||
|
while (currentIndex > 0 && this.heap[currentIndex] > this.heap[parentIndex]) {
|
||||||
|
this.swap(currentIndex, parentIndex);
|
||||||
|
currentIndex = parentIndex;
|
||||||
|
parentIndex = this.parent(parentIndex);
|
||||||
}
|
}
|
||||||
this.heap = arr;
|
}
|
||||||
|
this.swap = (index1, index2) => {
|
||||||
|
[this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]];
|
||||||
}
|
}
|
||||||
this.print = () => {
|
this.print = () => {
|
||||||
return this.heap.slice(1);
|
return this.heap;
|
||||||
}
|
}
|
||||||
// Only change code below this line
|
// Only change code below this line
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3d01000cf542c50fee3
|
id: 5900f3d01000cf542c50fee3
|
||||||
title: 'Problem 100: Arranged probability'
|
title: 'Problema 100: Probabilidade com arranjo'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301724
|
forumTopicId: 301724
|
||||||
dashedName: problem-100-arranged-probability
|
dashedName: problem-100-arranged-probability
|
||||||
@ -8,47 +8,47 @@ dashedName: problem-100-arranged-probability
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
If a box contains twenty-one colored discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs.
|
Suponha que uma caixa tem vinte e um discos coloridos, quinze discos azuis e seis discos vermelhos. Se dois discos forem escolhidos aleatoriamente, é possível ver a probabilidade de receber dois discos azuis.
|
||||||
|
|
||||||
$${P(BB)} = \frac{15}{21}×\frac{14}{20} = \frac{1}{2}$$
|
$${P(BB)} = \frac{15}{21}×\frac{14}{20} = \frac{1}{2}$$
|
||||||
|
|
||||||
The next such arrangement, for which there is exactly a 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
|
O arranjo seguinte, para o qual há exatamente 50% de chance de pegar dois discos azuis ao acaso, é uma caixa contendo oitenta e cinco discos azuis e trinta e cinco discos vermelhos.
|
||||||
|
|
||||||
By finding the first arrangement to contain over `limit` discs in total, determine the number of blue discs that the box would contain.
|
Ao encontrar o primeiro arranjo contendo `limit` discos no total, determine o número de discos azuis que a caixa contém.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`arrangedProbability(20)` should return a number.
|
`arrangedProbability(20)` deve retornar um número.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(typeof arrangedProbability(10) === 'number');
|
assert(typeof arrangedProbability(10) === 'number');
|
||||||
```
|
```
|
||||||
|
|
||||||
`arrangedProbability(20)` should return `15`.
|
`arrangedProbability(20)` deve retornar `15`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(arrangedProbability(20), 15);
|
assert.strictEqual(arrangedProbability(20), 15);
|
||||||
```
|
```
|
||||||
|
|
||||||
`arrangedProbability(100)` should return `85`.
|
`arrangedProbability(100)` deve retornar `85`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(arrangedProbability(100), 85);
|
assert.strictEqual(arrangedProbability(100), 85);
|
||||||
```
|
```
|
||||||
|
|
||||||
`arrangedProbability(100000)` should return `97513`.
|
`arrangedProbability(100000)` deve retornar `97513`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(arrangedProbability(100000), 97513);
|
assert.strictEqual(arrangedProbability(100000), 97513);
|
||||||
```
|
```
|
||||||
|
|
||||||
`arrangedProbability(1000000000)` should return `3822685023`.
|
`arrangedProbability(1000000000)` deve retornar `3822685023`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(arrangedProbability(1000000000), 3822685023);
|
assert.strictEqual(arrangedProbability(1000000000), 3822685023);
|
||||||
```
|
```
|
||||||
|
|
||||||
`arrangedProbability(1000000000000)` should return `756872327473`.
|
`arrangedProbability(1000000000000)` deve retornar `756872327473`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(arrangedProbability(1000000000000), 756872327473);
|
assert.strictEqual(arrangedProbability(1000000000000), 756872327473);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3d21000cf542c50fee4
|
id: 5900f3d21000cf542c50fee4
|
||||||
title: 'Problem 101: Optimum polynomial'
|
title: 'Problema 101: Polinômio ideal'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301725
|
forumTopicId: 301725
|
||||||
dashedName: problem-101-optimum-polynomial
|
dashedName: problem-101-optimum-polynomial
|
||||||
@ -8,29 +8,29 @@ dashedName: problem-101-optimum-polynomial
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polynomial functions that can model the sequence.
|
Se nos forem apresentados os primeiros termos k de uma sequência, é impossível dizer com certeza o valor do termo seguinte, uma vez que existem infinitas funções polinomiais que podem modelar a sequência.
|
||||||
|
|
||||||
As an example, let us consider the sequence of cube numbers. This is defined by the generating function, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$
|
Como exemplo, vamos considerar a sequencia de números cúbicos. Isso é definido pela função de geração, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$
|
||||||
|
|
||||||
Suppose we were only given the first two terms of this sequence. Working on the principle that "simple is best" we should assume a linear relationship and predict the next term to be 15 (common difference 7). Even if we were presented with the first three terms, by the same principle of simplicity, a quadratic relationship should be assumed.
|
Suponhamos que só nos foram dados os dois primeiros termos desta sequência. Trabalhando com o princípio de que "simples é melhor", devemos assumir uma relação linear e prever que o próximo termo será 15 (diferença comum 7). Mesmo que nos fossem apresentados os três primeiros termos, pelo mesmo princípio de simplicidade, uma relação quadrática deveria ser assumida.
|
||||||
|
|
||||||
We shall define $OP(k, n)$ to be the $n^{th}$ term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that $OP(k, n)$ will accurately generate the terms of the sequence for $n ≤ k$, and potentially the first incorrect term (FIT) will be $OP(k, k+1)$; in which case we shall call it a bad OP (BOP).
|
Definiremos $OP(k, n)$ como o termo $n^{th}$ da função de geração polinomial ótima para os primeiros termos k de uma sequência. Deve ficar claro que $OP(k, n)$ gerará com precisão os termos da sequência para $n ≤ k$ e, potencialmente, o primeiro termo incorreto (FIT) será $OP(k, k+1)$; Nesse caso, devemos chamá-lo de OP (BOP) ruim.
|
||||||
|
|
||||||
As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for $n ≥ 2, OP(1, n) = u_1$.
|
Como base, se nos fosse dado apenas o primeiro termo de sequência, seria mais sensato assumir constância, ou seja, por $n ≥ 2, OP(1, n) = u_1$.
|
||||||
|
|
||||||
Hence we obtain the following OPs for the cubic sequence:
|
Assim, obtemos as seguintes OPs para a sequência cúbica:
|
||||||
|
|
||||||
$$\begin{array}{ll} OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ OP(2, n) = 7n−6 & 1, 8, {\color{red}{15}}, \ldots \\\\ OP(3, n) = 6n^2−11n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots \end{array}$$
|
$$\begin{array}{ll} OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ OP(2, n) = 7n−6 & 1, 8, {\color{red}{15}}, \ldots \\\\ OP(3, n) = 6n^2−11n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots \end{array}$$
|
||||||
|
|
||||||
Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in $\color{red}{red}$ above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function:
|
Claramente não existem BOPs para k ≥ 4. Considerando a soma dos FITs gerados pelos BOPs (indicados em $\color{red}{red}$ acima), obtemos 1 + 15 + 58 = 74. Considere a seguinte função de geração de polinômios de décimo grau:
|
||||||
|
|
||||||
$$u_n = 1 − n + n^2 − n^3 + n^4 − n^5 + n^6 − n^7 + n^8 − n^9 + n^{10}$$
|
$$u_n = 1 − n + n^2 − n^3 + n^4 − n^5 + n^6 − n^7 + n^8 − n^9 + n^{10}$$
|
||||||
|
|
||||||
Find the sum of FITs for the BOPs.
|
Encontre a soma dos FITs para os BOPs.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`optimumPolynomial()` should return `37076114526`.
|
`optimumPolynomial()` deve retornar `37076114526`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(optimumPolynomial(), 37076114526);
|
assert.strictEqual(optimumPolynomial(), 37076114526);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3d91000cf542c50feeb
|
id: 5900f3d91000cf542c50feeb
|
||||||
title: 'Problem 108: Diophantine Reciprocals I'
|
title: 'Problema 108: Diofantinos recíprocos I'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301732
|
forumTopicId: 301732
|
||||||
dashedName: problem-108-diophantine-reciprocals-i
|
dashedName: problem-108-diophantine-reciprocals-i
|
||||||
@ -8,19 +8,19 @@ dashedName: problem-108-diophantine-reciprocals-i
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In the following equation x, y, and n are positive integers.
|
Na equação a seguir, x, y e n são inteiros positivos.
|
||||||
|
|
||||||
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
|
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
|
||||||
|
|
||||||
For `n` = 4 there are exactly three distinct solutions:
|
Para `n` = 4, há exatamente três soluções distintas:
|
||||||
|
|
||||||
$$\begin{align} & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ \\\\ & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ \\\\ & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} \end{align}$$
|
$$\begin{align} & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ \\\\ & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ \\\\ & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} \end{align}$$
|
||||||
|
|
||||||
What is the least value of `n` for which the number of distinct solutions exceeds one-thousand?
|
Qual é o menor valor de `n` para o qual o número de soluções distintas excede um mil?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`diophantineOne()` should return `180180`.
|
`diophantineOne()` deve retornar `180180`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(diophantineOne(), 180180);
|
assert.strictEqual(diophantineOne(), 180180);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3db1000cf542c50feed
|
id: 5900f3db1000cf542c50feed
|
||||||
title: 'Problem 110: Diophantine Reciprocals II'
|
title: 'Problema 110: Diofantinos recíprocos II'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301735
|
forumTopicId: 301735
|
||||||
dashedName: problem-110-diophantine-reciprocals-ii
|
dashedName: problem-110-diophantine-reciprocals-ii
|
||||||
@ -8,19 +8,19 @@ dashedName: problem-110-diophantine-reciprocals-ii
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In the following equation x, y, and n are positive integers.
|
Na equação a seguir, x, y e n são inteiros positivos.
|
||||||
|
|
||||||
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
|
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
|
||||||
|
|
||||||
It can be verified that when `n` = 1260 there are 113 distinct solutions and this is the least value of `n` for which the total number of distinct solutions exceeds one hundred.
|
Pode ser verificado que, quando `n` = 1260, existem 113 soluções distintas e este é o menor valor de `n` para o qual o número total de soluções distintas excede cem.
|
||||||
|
|
||||||
What is the least value of `n` for which the number of distinct solutions exceeds four million?
|
Qual é o menor valor de `n` para o qual o número de soluções distintas excede quatro milhões?
|
||||||
|
|
||||||
**Note:** This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation.
|
**Nota:** este problema é uma versão muito mais difícil do Problema 108 e, como está muito além das limitações de uma abordagem de força bruta, requer uma implementação inteligente.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`diophantineTwo()` should return `9350130049860600`.
|
`diophantineTwo()` deve retornar `9350130049860600`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(diophantineTwo(), 9350130049860600);
|
assert.strictEqual(diophantineTwo(), 9350130049860600);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3ef1000cf542c50ff02
|
id: 5900f3ef1000cf542c50ff02
|
||||||
title: 'Problem 131: Prime cube partnership'
|
title: 'Problema 131: Associação dos cubos primos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301759
|
forumTopicId: 301759
|
||||||
dashedName: problem-131-prime-cube-partnership
|
dashedName: problem-131-prime-cube-partnership
|
||||||
@ -8,20 +8,20 @@ dashedName: problem-131-prime-cube-partnership
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
|
Existem alguns valores primos, $p$, para os quais também existe um número inteiro positivo, $n$, tal que a expressão $n^3 + n^{2}p$ é um cubo perfeito.
|
||||||
|
|
||||||
For example, when p = 19, 83 + 82×19 = 123.
|
Por exemplo, quando $p = 19,\\ 8^3 + 8^2 x 19 = {12}^3$.
|
||||||
|
|
||||||
What is perhaps most surprising is that for each prime with this property the value of n is unique, and there are only four such primes below one-hundred.
|
O que é talvez mais surpreendente é que o valor de $n$ é único para cada primo com essa propriedade, e só existem 4 primos com essa propriedade abaixo de 100.
|
||||||
|
|
||||||
How many primes below one million have this remarkable property?
|
Quantos primos abaixo de 1 milhão possuem essa propriedade notável?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler131()` should return 173.
|
`primeCubePartnership()` deve retornar `173`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler131(), 173);
|
assert.strictEqual(primeCubePartnership(), 173);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +29,12 @@ assert.strictEqual(euler131(), 173);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler131() {
|
function primeCubePartnership() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler131();
|
primeCubePartnership();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3f11000cf542c50ff03
|
id: 5900f3f11000cf542c50ff03
|
||||||
title: 'Problem 132: Large repunit factors'
|
title: 'Problema 132: Fatores repunit grandes'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301760
|
forumTopicId: 301760
|
||||||
dashedName: problem-132-large-repunit-factors
|
dashedName: problem-132-large-repunit-factors
|
||||||
@ -8,18 +8,18 @@ dashedName: problem-132-large-repunit-factors
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k.
|
Em inglês, um número que consiste apenas de 1s é chamado de repunit. Devemos definir $R(k)$ como uma repunit de tamanho $k$.
|
||||||
|
|
||||||
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime factors is 9414.
|
Por exemplo, $R(10) = 1111111111 = 11 × 41 × 271 × 9091$, e a soma desses fatores primos é 9414.
|
||||||
|
|
||||||
Find the sum of the first forty prime factors of R(109).
|
Encontre a soma dos 40 primeiros fatores primos de $R({10}^9)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler132()` should return 843296.
|
`largeRepunitFactors()` deve retornar `843296`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler132(), 843296);
|
assert.strictEqual(largeRepunitFactors(), 843296);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -27,12 +27,12 @@ assert.strictEqual(euler132(), 843296);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler132() {
|
function largeRepunitFactors() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler132();
|
largeRepunitFactors();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
Reference in New Issue
Block a user