chore(i18n,curriculum): processed translations (#41939)
This commit is contained in:
@ -43,7 +43,7 @@ module.exports = function (app, myDataBase) {
|
|||||||
);
|
);
|
||||||
assert.match(
|
assert.match(
|
||||||
data,
|
data,
|
||||||
/client.db[^]*routes/gi,
|
/client\s*\.db[^]*routes/gi,
|
||||||
'Your new modules should be called after your connection to the database'
|
'Your new modules should be called after your connection to the database'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -29,6 +29,8 @@ Aquí hay un ejemplo:
|
|||||||
|
|
||||||
Camper Cat tiene un campo de búsqueda en su página de Citas Inspiradoras que planea colocar en la esquina superior derecha con CSS. Él quiere que los controles de formulario de búsqueda `input` y envío `input` sean los dos primeros elementos en el orden de tabulación. Agrega un atributo `tabindex` establecido en `1` al `search` `input`, y un atributo `tabindex` establecido en `2` al `submit` `input`.
|
Camper Cat tiene un campo de búsqueda en su página de Citas Inspiradoras que planea colocar en la esquina superior derecha con CSS. Él quiere que los controles de formulario de búsqueda `input` y envío `input` sean los dos primeros elementos en el orden de tabulación. Agrega un atributo `tabindex` establecido en `1` al `search` `input`, y un atributo `tabindex` establecido en `2` al `submit` `input`.
|
||||||
|
|
||||||
|
Otra cosa a tener en cuenta es que algunos navegadores pueden colocarlo en el centro del orden de la pestaña cuando se hace clic en un elemento. Se ha añadido un elemento a la página que asegura que siempre comenzará al principio de su orden de pestañas.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Tu código debe agregar un atributo `tabindex` a la etiqueta `search` `input`.
|
Tu código debe agregar un atributo `tabindex` a la etiqueta `search` `input`.
|
||||||
@ -61,6 +63,7 @@ assert($('#submit').attr('tabindex') == '2');
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<body>
|
<body>
|
||||||
|
<div tabindex="1" class="overlay"></div>
|
||||||
<header>
|
<header>
|
||||||
<h1>Even Deeper Thoughts with Master Camper Cat</h1>
|
<h1>Even Deeper Thoughts with Master Camper Cat</h1>
|
||||||
<nav>
|
<nav>
|
||||||
@ -91,12 +94,26 @@ assert($('#submit').attr('tabindex') == '2');
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
<footer>© 2018 Camper Cat</footer>
|
<footer>© 2018 Camper Cat</footer>
|
||||||
</body>
|
</body>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
.overlay {
|
||||||
|
margin: -8px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<body>
|
<body>
|
||||||
|
<div tabindex="1" class="overlay"></div>
|
||||||
<header>
|
<header>
|
||||||
<h1>Even Deeper Thoughts with Master Camper Cat</h1>
|
<h1>Even Deeper Thoughts with Master Camper Cat</h1>
|
||||||
<nav>
|
<nav>
|
||||||
@ -127,4 +144,17 @@ assert($('#submit').attr('tabindex') == '2');
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
<footer>© 2018 Camper Cat</footer>
|
<footer>© 2018 Camper Cat</footer>
|
||||||
</body>
|
</body>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
.overlay {
|
||||||
|
margin: -8px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
```
|
```
|
||||||
|
@ -15,7 +15,7 @@ El círculo cromático es una herramienta útil para observar cómo los colores
|
|||||||
|
|
||||||
A continuación hay algunos ejemplos de colores con sus códigos hexadecimales:
|
A continuación hay algunos ejemplos de colores con sus códigos hexadecimales:
|
||||||
|
|
||||||
<blockquote>rojo (#FF0000) y cian (#00FFFF)<br>verde(#00FF00) y magenta (#FF00FF)<br>azul (#0000FF) y amarillo (#FFF00)</blockquote>
|
<blockquote>rojo (#FF0000) y cian (#00FFFF)<br>verde(#00FF00) y magenta (#FF00FF)<br>azul (#0000FF) y amarillo (#FFFF00)</blockquote>
|
||||||
|
|
||||||
Esto es diferente del anticuado modelo de color RYB que muchos de nosotros aprendimos en la escuela, que tiene diferentes colores primarios y complementarios. La teoría moderna del color utiliza el modelo aditivo RGB (como en una pantalla de computadora) y el modelo restante CMY(K) (como en la impresión). Lee [aquí](https://en.wikipedia.org/wiki/Color_model) para obtener más información sobre este complejo tema.
|
Esto es diferente del anticuado modelo de color RYB que muchos de nosotros aprendimos en la escuela, que tiene diferentes colores primarios y complementarios. La teoría moderna del color utiliza el modelo aditivo RGB (como en una pantalla de computadora) y el modelo restante CMY(K) (como en la impresión). Lee [aquí](https://en.wikipedia.org/wiki/Color_model) para obtener más información sobre este complejo tema.
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Intentemos agregar una imagen a nuestro sitio web:
|
|||||||
|
|
||||||
Dentro del elemento `main`, inserta un elemento `img` antes de los elementos `p` existentes.
|
Dentro del elemento `main`, inserta un elemento `img` antes de los elementos `p` existentes.
|
||||||
|
|
||||||
Ahora establece el atributo `src` para que apunte a la url `https://bit.ly/fcc-relaxing-cat`
|
Ahora establece el atributo `src` para que apunte a la url `https://www.bit.ly/fcc-relaxing-cat`
|
||||||
|
|
||||||
Finalmente, no olvides darle a tu elemento `img` un atributo `alt` con texto descriptivo.
|
Finalmente, no olvides darle a tu elemento `img` un atributo `alt` con texto descriptivo.
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ assert($('img').length);
|
|||||||
Tu imagen debe tener un atributo `src` que apunte a la imagen del gatito.
|
Tu imagen debe tener un atributo `src` que apunte a la imagen del gatito.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(/^https:\/\/bit\.ly\/fcc-relaxing-cat$/i.test($('img').attr('src')));
|
assert(/^https:\/\/www\.bit\.ly\/fcc-relaxing-cat$/i.test($('img').attr('src')));
|
||||||
```
|
```
|
||||||
|
|
||||||
El atributo `alt` de tu elemento imagen no debe estar vacío.
|
El atributo `alt` de tu elemento imagen no debe estar vacío.
|
||||||
@ -86,7 +86,7 @@ assert(
|
|||||||
```html
|
```html
|
||||||
<h2>CatPhotoApp</h2>
|
<h2>CatPhotoApp</h2>
|
||||||
<main>
|
<main>
|
||||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
<a href="#"><img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
</main>
|
</main>
|
||||||
|
@ -20,7 +20,7 @@ Por ejemplo:
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Anida el elemento `input` existente dentro de un elemento `form` y asigna `"https://freecatphotoapp.com/submit-cat-photo"` al atributo `action` del elemento `form`.
|
Anida el elemento `input` existente dentro de un elemento `form` y asigna `"https://www.freecatphotoapp.com/submit-cat-photo"` al atributo `action` del elemento `form`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@ -34,11 +34,11 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu formulario `form` debe tener un atributo `action` que esté establecido como `https://freecatphotoapp.com/submit-cat-photo`
|
Tu formulario `form` debe tener un atributo `action` que esté establecido como `https://www.freecatphotoapp.com/submit-cat-photo`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
$('form').attr('action') === 'https://freecatphotoapp.com/submit-cat-photo'
|
$('form').attr('action') === 'https://www.freecatphotoapp.com/submit-cat-photo'
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ assert(
|
|||||||
<main>
|
<main>
|
||||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||||
|
|
||||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
<a href="#"><img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||||
|
|
||||||
<p>Things cats love:</p>
|
<p>Things cats love:</p>
|
||||||
<ul>
|
<ul>
|
||||||
@ -86,7 +86,7 @@ assert(
|
|||||||
<main>
|
<main>
|
||||||
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
<p>Click here to view more <a href="#">cat photos</a>.</p>
|
||||||
|
|
||||||
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
<a href="#"><img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||||
|
|
||||||
<p>Things cats love:</p>
|
<p>Things cats love:</p>
|
||||||
<ul>
|
<ul>
|
||||||
@ -100,7 +100,7 @@ assert(
|
|||||||
<li>thunder</li>
|
<li>thunder</li>
|
||||||
<li>other cats</li>
|
<li>other cats</li>
|
||||||
</ol>
|
</ol>
|
||||||
<form action="https://freecatphotoapp.com/submit-cat-photo">
|
<form action="https://www.freecatphotoapp.com/submit-cat-photo">
|
||||||
<input type="text" placeholder="cat photo URL">
|
<input type="text" placeholder="cat photo URL">
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
@ -14,14 +14,14 @@ Puedes usar los elementos `a` (*anchor*) para enlazar a contenido fuera de tu p
|
|||||||
Los elementos `a` requieren un atributo `href` con la dirección web de destino. También necesitan un texto anchor. Por ejemplo:
|
Los elementos `a` requieren un atributo `href` con la dirección web de destino. También necesitan un texto anchor. Por ejemplo:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<a href="https://freecodecamp.org">this links to freecodecamp.org</a>
|
<a href="https://www.freecodecamp.org">this links to freecodecamp.org</a>
|
||||||
```
|
```
|
||||||
|
|
||||||
Entonces tu navegador mostrará el texto `this links to freecodecamp.org` como un enlace que puedes hacer clic. Y ese enlace te llevará a la dirección web `https://www.freecodecamp.org`.
|
Entonces tu navegador mostrará el texto `this links to freecodecamp.org` como un enlace que puedes hacer clic. Y ese enlace te llevará a la dirección web `https://www.freecodecamp.org`.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
Crea un elemento `a` que enlace a `https://freecatphotoapp.com` y tenga "cat photos" como su texto anchor.
|
Crea un elemento `a` que enlaza a `https://www.freecatphotoapp.com` y tiene "cat photos" como su texto de ancla.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
@ -31,10 +31,10 @@ Tu elemento `a` debe contener el texto anchor: `cat photos`.
|
|||||||
assert(/cat photos/gi.test($('a').text()));
|
assert(/cat photos/gi.test($('a').text()));
|
||||||
```
|
```
|
||||||
|
|
||||||
Necesitas un elemento `a` que enlace `https://freecatphotoapp.com`
|
Necesitas un elemento `a` que enlace a `https://www.freecatphotoapp.com`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(/^https?:\/\/freecatphotoapp\.com\/?$/i.test($('a').attr('href')));
|
assert(/^https?:\/\/www\.freecatphotoapp\.com\/?$/i.test($('a').attr('href')));
|
||||||
```
|
```
|
||||||
|
|
||||||
Tu elemento `a` debe tener una etiqueta de cierre.
|
Tu elemento `a` debe tener una etiqueta de cierre.
|
||||||
@ -56,7 +56,7 @@ assert(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
<img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||||
|
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
@ -69,9 +69,9 @@ assert(
|
|||||||
<h2>CatPhotoApp</h2>
|
<h2>CatPhotoApp</h2>
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
<img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||||
|
|
||||||
<a href="https://freecatphotoapp.com">cat photos</a>
|
<a href="https://www.freecatphotoapp.com">cat photos</a>
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
</main>
|
</main>
|
||||||
|
@ -15,7 +15,7 @@ Esto también es útil cuando estás cambiando el comportamiento de un enlace us
|
|||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
El valor actual del atributo `href` es un enlace que apunta a "`https://freecatphotoapp.com`". Reemplaza el valor del atributo `href` por un `#` (también conocido como símbolo hash, numeral o almohadilla) para crear un enlace muerto.
|
El valor actual del atributo `href` es un enlace que apunta a "`https://www.freecatphotoapp.com`". Reemplaza el valor del atributo `href` por un `#` (también conocido como símbolo hash, numeral o almohadilla) para crear un enlace muerto.
|
||||||
|
|
||||||
Por ejemplo: `href="#"`
|
Por ejemplo: `href="#"`
|
||||||
|
|
||||||
@ -34,9 +34,9 @@ assert($('a').attr('href') === '#');
|
|||||||
```html
|
```html
|
||||||
<h2>CatPhotoApp</h2>
|
<h2>CatPhotoApp</h2>
|
||||||
<main>
|
<main>
|
||||||
<p>Click here to view more <a href="https://freecatphotoapp.com" target="_blank">cat photos</a>.</p>
|
<p>Click here to view more <a href="https://www.freecatphotoapp.com" target="_blank">cat photos</a>.</p>
|
||||||
|
|
||||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
<img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||||
|
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
@ -50,7 +50,7 @@ assert($('a').attr('href') === '#');
|
|||||||
<main>
|
<main>
|
||||||
<p>Click here to view more <a href="#" target="_blank">cat photos</a>.</p>
|
<p>Click here to view more <a href="#" target="_blank">cat photos</a>.</p>
|
||||||
|
|
||||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
<img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||||
|
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
|
@ -12,7 +12,7 @@ Puedes anidar enlaces dentro de otros elementos de texto.
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<p>
|
<p>
|
||||||
Here's a <a target="_blank" href="https://www.freecodecamp.org"> link to freecodecamp.org</a> for you to follow.
|
Here's a <a target="_blank" href="https://www.freecodecamp.org"> link to www.freecodecamp.org</a> for you to follow.
|
||||||
</p>
|
</p>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ A continuación está el elemento *anchor* `<a>` (que requiere una etiqueta de c
|
|||||||
<a href="https://www.freecodecamp.org" target="_blank"> ... </a>
|
<a href="https://www.freecodecamp.org" target="_blank"> ... </a>
|
||||||
```
|
```
|
||||||
|
|
||||||
El texto, `link to freecodecamp.org`, dentro de un elemento `a` se llama <dfn>anchor text</dfn>, y mostrará el enlace para hacer clic:
|
El texto, `link to www.freecodecamp.org`, dentro de un elemento `a` se llama <dfn>texto de anclaje</dfn>, y mostrará el enlace para hacer clic:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<a href=" ... " target="...">link to freecodecamp.org</a>
|
<a href=" ... " target="...">link to freecodecamp.org</a>
|
||||||
@ -42,7 +42,7 @@ El texto, `link to freecodecamp.org`, dentro de un elemento `a` se llama <dfn>an
|
|||||||
|
|
||||||
El resultado final del ejemplo se verá así:
|
El resultado final del ejemplo se verá así:
|
||||||
|
|
||||||
Aquí hay un enlace <a href="https://www.freecodecamp.org" target="_blank">a freecodecamp.org</a> para que lo sigas.
|
Aquí hay un enlace <a href="https://www.freecodecamp.org" target="_blank">a www.freecodecamp.org</a> para que lo sigas.
|
||||||
|
|
||||||
# --instructions--
|
# --instructions--
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ assert(
|
|||||||
|
|
||||||
<a href="https://www.freecatphotoapp.com" target="_blank">cat photos</a>
|
<a href="https://www.freecatphotoapp.com" target="_blank">cat photos</a>
|
||||||
|
|
||||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
<img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||||
|
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
@ -155,7 +155,7 @@ assert(
|
|||||||
<main>
|
<main>
|
||||||
<p>View more <a target="_blank" href="https://www.freecatphotoapp.com">cat photos</a></p>
|
<p>View more <a target="_blank" href="https://www.freecatphotoapp.com">cat photos</a></p>
|
||||||
|
|
||||||
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
<img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
||||||
|
|
||||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||||
|
@ -8,21 +8,21 @@ dashedName: record-collection
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Se te da un objeto JSON que representa una parte de tu colección de álbumes musicales. Cada álbum tiene un número de id único como clave y varias otras propiedades. No todos los álbumes tienen una información completa.
|
Se te da un objeto literal que representa una parte de tu colección de álbumes musicales. Cada álbum tiene un número de id único como clave y varias otras propiedades. No todos los álbumes tienen una información completa.
|
||||||
|
|
||||||
Empiezas con una función `updateRecords` el cual toma un objeto `collection`, un `id`, una `prop` (como `artist` o `tracks`), y un `value`. Completa la función usando las reglas siguientes para modificar el objeto pasado a la función.
|
Empiezas con una función `updateRecords` la cual toma un objeto literal, `records`, que contiene el álbum musical de la colección, un `id`, `prop` (como `artist` o `tracks`), y `value`. Completa la función usando las reglas siguientes para modificar el objeto pasado a la función.
|
||||||
|
|
||||||
- Tu función siempre debe devolver el objeto completo.
|
- Tu función siempre debe devolver el objeto de colección de registros completo.
|
||||||
- Si `prop` no es `tracks` y `value` no es una cadena vacía, actualiza o establece la propiedad `prop` del album a `value`.
|
- Si `prop` no es `tracks` y `value` no es una cadena vacía, actualiza o establece la propiedad `prop` del album a `value`.
|
||||||
- Si `prop` es `tracks` pero el álbum no tiene una propiedad `tracks`, crea un arreglo vacío y agrégale `value` a él.
|
- Si `prop` es `tracks` pero el álbum no tiene una propiedad `tracks`, crea un arreglo vacío y agrégale `value` a él.
|
||||||
- Si `prop` es `tracks` y `value` no es una cadena vacía, agrega `value` al final del arreglo de `tracks` existentes del álbum.
|
- Si `prop` es `tracks` y `value` no es una cadena vacía, agrega `value` al final del arreglo de `tracks` existentes del álbum.
|
||||||
- Si `value` es una cadena vacía, elimina esa propiedad `prop` del álbum.
|
- Si `value` es una cadena vacía, elimina esa propiedad `prop` del álbum.
|
||||||
|
|
||||||
**Nota:** Una copia del objeto `collection` es usada para las pruebas.
|
**Nota:** Se usa una copia del objeto `recordCollection` para las pruebas.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
Después de `updateRecords(collection, 5439, "artist", "ABBA")`, `artist` debe ser la cadena `ABBA`
|
Después `updateRecords(recordCollection, 5439, "artist", "ABBA")`, `artist` debe ser la cadena `ABBA`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -31,7 +31,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Después de `updateRecords(collection, 5439, "tracks", "Take a Chance on Me")`, `tracks` debe tener la cadena `Take a Chance on Me` como último elemento.
|
Después de `updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me")`, `tracks` debe tener la cadena `Take a Chance on Me` como último elemento.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -41,14 +41,14 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Después de `updateRecords(collection, 2548, "artist", "")`, `artist` no debe establecerse
|
Después de `updateRecords(recordCollection, 2548, "artist", "")`, `artist` no se debe establecido
|
||||||
|
|
||||||
```js
|
```js
|
||||||
updateRecords(_recordCollection, 2548, 'artist', '');
|
updateRecords(_recordCollection, 2548, 'artist', '');
|
||||||
assert(!_recordCollection[2548].hasOwnProperty('artist'));
|
assert(!_recordCollection[2548].hasOwnProperty('artist'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Después de `updateRecords(collection, 1245, "tracks", "Addicted to Love")`, `tracks` debe tener la cadena `Addicted to Love` como último elemento.
|
Después de `updateRecords(recordCollection, 1245, "tracks", "Addicted to Love")`, `tracks` debe tener la cadena `Addicted to Love` como último elemento.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -58,7 +58,7 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Después de `updateRecords(collection, 2468, "tracks", "Free")`, `tracks` debe tener la cadena `1999` como primer elemento.
|
Después `updateRecords(recordCollection, 2468, "tracks", "Free")`, `tracks` debe tener la cadena `1999` como el primer elemento.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -68,14 +68,14 @@ assert(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Después de `updateRecords(collection, 2548, "tracks", "")`, `tracks` no debe establecerse
|
Después `updateRecords(recordCollection, 2548, "tracks", "")`, `tracks` no se debe establecido
|
||||||
|
|
||||||
```js
|
```js
|
||||||
updateRecords(_recordCollection, 2548, 'tracks', '');
|
updateRecords(_recordCollection, 2548, 'tracks', '');
|
||||||
assert(!_recordCollection[2548].hasOwnProperty('tracks'));
|
assert(!_recordCollection[2548].hasOwnProperty('tracks'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Después de `updateRecords(collection, 1245, "albumTitle", "Riptide")`, `albumTitle` debe ser la cadena `Riptide`
|
Después de `updateRecords(recordCollection, 1245, "albumTitle", "Riptide")`, `albumTitle` debe ser la cadena `Riptide`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(
|
assert(
|
||||||
@ -115,7 +115,7 @@ const _recordCollection = {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// Setup
|
// Setup
|
||||||
var collection = {
|
var recordCollection = {
|
||||||
2548: {
|
2548: {
|
||||||
albumTitle: 'Slippery When Wet',
|
albumTitle: 'Slippery When Wet',
|
||||||
artist: 'Bon Jovi',
|
artist: 'Bon Jovi',
|
||||||
@ -136,17 +136,17 @@ var collection = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Only change code below this line
|
// Only change code below this line
|
||||||
function updateRecords(object, id, prop, value) {
|
function updateRecords(records, id, prop, value) {
|
||||||
return object;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRecords(collection, 5439, 'artist', 'ABBA');
|
updateRecords(recordCollection, 5439, 'artist', 'ABBA');
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var collection = {
|
var recordCollection = {
|
||||||
2548: {
|
2548: {
|
||||||
albumTitle: 'Slippery When Wet',
|
albumTitle: 'Slippery When Wet',
|
||||||
artist: 'Bon Jovi',
|
artist: 'Bon Jovi',
|
||||||
@ -167,15 +167,15 @@ var collection = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Only change code below this line
|
// Only change code below this line
|
||||||
function updateRecords(object, id, prop, value) {
|
function updateRecords(records, id, prop, value) {
|
||||||
if (value === '') delete object[id][prop];
|
if (value === '') delete records[id][prop];
|
||||||
else if (prop === 'tracks') {
|
else if (prop === 'tracks') {
|
||||||
object[id][prop] = object[id][prop] || [];
|
records[id][prop] = records[id][prop] || [];
|
||||||
object[id][prop].push(value);
|
records[id][prop].push(value);
|
||||||
} else {
|
} else {
|
||||||
object[id][prop] = value;
|
records[id][prop] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return object;
|
return records;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user