chore(i18n,learn): processed translations (#41378)
* chore(i8n,learn): processed translations * Update curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-u-tag-to-underline-text.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5cdafbc32913098997531680
|
||||
title: Complete a Promise with resolve and reject
|
||||
title: Cumple una Promesa con "Resolve" y "Reject"
|
||||
challengeType: 1
|
||||
forumTopicId: 301196
|
||||
dashedName: complete-a-promise-with-resolve-and-reject
|
||||
@ -8,7 +8,7 @@ dashedName: complete-a-promise-with-resolve-and-reject
|
||||
|
||||
# --description--
|
||||
|
||||
A promise has three states: `pending`, `fulfilled`, and `rejected`. The promise you created in the last challenge is forever stuck in the `pending` state because you did not add a way to complete the promise. The `resolve` and `reject` parameters given to the promise argument are used to do this. `resolve` is used when you want your promise to succeed, and `reject` is used when you want it to fail. These are methods that take an argument, as seen below.
|
||||
Una promesa tiene tres estados: `pending`, `fulfilled`, y `rejected`. La promesa creada en el último desafío está atascada en el estado `pending` porque no añadiste una forma de completar la promesa. Los parámetros `resolve` y `reject` enviados a "promise" como argumentos, son utilizados para hacer lo siguiente. `resolve` se utiliza, cuando la promesa es cumplida y `reject` cuando es rechazada. Estos son métodos que toman un argumento, como se ve a continuación.
|
||||
|
||||
```js
|
||||
const myPromise = new Promise((resolve, reject) => {
|
||||
@ -20,15 +20,15 @@ const myPromise = new Promise((resolve, reject) => {
|
||||
});
|
||||
```
|
||||
|
||||
The example above uses strings for the argument of these functions, but it can really be anything. Often, it might be an object, that you would use data from, to put on your website or elsewhere.
|
||||
El ejemplo anterior utiliza strings como argumento de las funciones, pero podrían ser cualquier otra cosa. A menudo, podría ser un objeto, del que utilizas datos, para colocar en tu sitio web o en otro lugar.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Make the promise handle success and failure. If `responseFromServer` is `true`, call the `resolve` method to successfully complete the promise. Pass `resolve` a string with the value `We got the data`. If `responseFromServer` is `false`, use the `reject` method instead and pass it the string: `Data not received`.
|
||||
Haga una función promesa que maneje el éxito y el fallo. Si `responseFromServer` es `true`, llame al método `resolve` para completar satisfactoriamente la promesa. `resolve` devuelve un string con el valor `We got the data`. Si `responseFromServer` es `false`, utilice el método `reject` y devuelva la cadena: `Data not received`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`resolve` should be called with the expected string when the `if` condition is `true`.
|
||||
`resolve` debe ser llamada con el string esperado, cuando la condición `if` es `true`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -40,7 +40,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`reject` should be called with the expected string when the `if` condition is `false`.
|
||||
`reject` debe ser llamada con el string esperado, cuando la condición `if` es `false`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5cdafbb0291309899753167f
|
||||
title: Create a JavaScript Promise
|
||||
title: Crea una promesa de JavaScript
|
||||
challengeType: 1
|
||||
forumTopicId: 301197
|
||||
dashedName: create-a-javascript-promise
|
||||
@ -8,7 +8,7 @@ dashedName: create-a-javascript-promise
|
||||
|
||||
# --description--
|
||||
|
||||
A promise in JavaScript is exactly what it sounds like - you use it to make a promise to do something, usually asynchronously. When the task completes, you either fulfill your promise or fail to do so. `Promise` is a constructor function, so you need to use the `new` keyword to create one. It takes a function, as its argument, with two parameters - `resolve` and `reject`. These are methods used to determine the outcome of the promise. The syntax looks like this:
|
||||
Una promesa en JavaScript es exactamente lo que suena, la usas para hacer una promesa de hacer algo, normalmente de forma asíncrona. Cuando la tarea se complete, cumple su promesa o no la cumple. `Promise` es una función constructora, así que tu necesitas usar la palabra clave `new` para crear una. Toma una función como su argumento, con dos parámetros - `resolve` y `reject`. Estos son métodos utilizados para determinar el resultado de la promesa. La sintaxis se ve así:
|
||||
|
||||
```js
|
||||
const myPromise = new Promise((resolve, reject) => {
|
||||
@ -18,17 +18,17 @@ const myPromise = new Promise((resolve, reject) => {
|
||||
|
||||
# --instructions--
|
||||
|
||||
Create a new promise called `makeServerRequest`. Pass in a function with `resolve` and `reject` parameters to the constructor.
|
||||
Crea una nueva promesa llamada `makeServerRequest`. Pase en una función con `resolve` y `reject` parámetros al constructor.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should assign a promise to a declared variable named `makeServerRequest`.
|
||||
Debes asignar una promesa a una variable declarada con el nombre `makeServerRequest`.
|
||||
|
||||
```js
|
||||
assert(makeServerRequest instanceof Promise);
|
||||
```
|
||||
|
||||
Your promise should receive a function with `resolve` and `reject` as parameters.
|
||||
Tu promesa debe recibir una función con `resolve` y `reject` como parámetros.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -41,7 +41,9 @@ assert(
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5cdafbd72913098997531681
|
||||
title: Handle a Fulfilled Promise with then
|
||||
title: Maneja una promesa cumplida usando then
|
||||
challengeType: 1
|
||||
forumTopicId: 301203
|
||||
dashedName: handle-a-fulfilled-promise-with-then
|
||||
@ -8,23 +8,23 @@ dashedName: handle-a-fulfilled-promise-with-then
|
||||
|
||||
# --description--
|
||||
|
||||
Promises are most useful when you have a process that takes an unknown amount of time in your code (i.e. something asynchronous), often a server request. When you make a server request it takes some amount of time, and after it completes you usually want to do something with the response from the server. This can be achieved by using the `then` method. The `then` method is executed immediately after your promise is fulfilled with `resolve`. Here’s an example:
|
||||
Las promesas son muy útiles, cuando tu tienes un proceso que toma una cantidad de tiempo desconocida en tu código (algo asíncrono por ejemplo), a menudo una petición de servidor. Cuando tu haces una petición a un servidor, toma algo de tiempo, después de que termina, normalmente quieres hacer algo con la respuesta del servidor. Esto se puede lograr utilizando el método `then`. El método `then`, se ejecuta inmediatamente después de que tu promesa se cumple con `resolve`. A continuación un ejemplo:
|
||||
|
||||
```js
|
||||
myPromise.then(result => {
|
||||
// do something with the result.
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
`result` comes from the argument given to the `resolve` method.
|
||||
`result` viene con el argumento proporcionado al método `resolve`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the `then` method to your promise. Use `result` as the parameter of its callback function and log `result` to the console.
|
||||
Añade el método `then` a tu promesa. Usa `result` como parámetro de tu función callback, asimismo imprime `result` en la consola.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should call the `then` method on the promise.
|
||||
Debes llamar al método `then` en la promesa.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -32,13 +32,13 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `then` method should have a callback function with `result` as its parameter.
|
||||
El método `then`, debe tener una función callback con `result` como parámetro.
|
||||
|
||||
```js
|
||||
assert(resultIsParameter);
|
||||
```
|
||||
|
||||
You should log `result` to the console.
|
||||
Debes imprimir `result` en la consola.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5cdafbe72913098997531682
|
||||
title: Handle a Rejected Promise with catch
|
||||
title: Maneja una promesa rechazada usando catch
|
||||
challengeType: 1
|
||||
forumTopicId: 301204
|
||||
dashedName: handle-a-rejected-promise-with-catch
|
||||
@ -8,23 +8,23 @@ dashedName: handle-a-rejected-promise-with-catch
|
||||
|
||||
# --description--
|
||||
|
||||
`catch` is the method used when your promise has been rejected. It is executed immediately after a promise's `reject` method is called. Here’s the syntax:
|
||||
`catch` es el método utilizado cuando tu promesa ha sido rechazada. Se ejecuta inmediatamente, después de que se llama al método `reject` de una promesa. A continuación la sintaxis:
|
||||
|
||||
```js
|
||||
myPromise.catch(error => {
|
||||
// do something with the error.
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
`error` is the argument passed in to the `reject` method.
|
||||
`error` es el argumento pasado al método `reject`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the `catch` method to your promise. Use `error` as the parameter of its callback function and log `error` to the console.
|
||||
Añade el método `catch` a tu promesa. Usa `error` como el parámetro de tu función callback e imprime `error` en la consola.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should call the `catch` method on the promise.
|
||||
Debes llamar al método `catch` en la promesa.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -32,13 +32,13 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `catch` method should have a callback function with `error` as its parameter.
|
||||
El método `catch`, debe tener una función callback con `error` como parámetro.
|
||||
|
||||
```js
|
||||
assert(errorIsParameter);
|
||||
```
|
||||
|
||||
You should log `error` to the console.
|
||||
Debes imprimir `error` en la consola.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
Reference in New Issue
Block a user