chore(i8n,curriculum): processed translations (#41490)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b8d367417b2b2512b59
|
||||
title: Import a Default Export
|
||||
title: Importa una exportación por defecto
|
||||
challengeType: 1
|
||||
forumTopicId: 301205
|
||||
dashedName: import-a-default-export
|
||||
@ -8,21 +8,21 @@ dashedName: import-a-default-export
|
||||
|
||||
# --description--
|
||||
|
||||
In the last challenge, you learned about `export default` and its uses. To import a default export, you need to use a different `import` syntax. In the following example, `add` is the default export of the `math_functions.js` file. Here is how to import it:
|
||||
En el último desafío, aprendiste sobre `export default` (exportación por defecto) y sus usos. Para importar una exportación por defecto, necesita utilizar la sintaxis `import` de manera diferente. En el siguiente ejemplo, `add` es la exportación por defecto del archivo `math_functions.js`. A continuación, cómo importarlo:
|
||||
|
||||
```js
|
||||
import add from "./math_functions.js";
|
||||
```
|
||||
|
||||
The syntax differs in one key place. The imported value, `add`, is not surrounded by curly braces (`{}`). `add` here is simply a variable name for whatever the default export of the `math_functions.js` file is. You can use any name here when importing a default.
|
||||
La sintaxis difiere en un punto clave. El valor importado, `add`, no está rodeado por llaves (`{}`). `add`, aquí es simplemente un nombre de variable, para cualquiera que sea la exportación por defecto del archivo `math_functions.js`. Puedes utilizar cualquier nombre aquí, al importar un valor por defecto.
|
||||
|
||||
# --instructions--
|
||||
|
||||
In the following code, import the default export from the `math_functions.js` file, found in the same directory as this file. Give the import the name `subtract`.
|
||||
El siguiente código, importa como exportación por defecto, desde el archivo `math_functions.js`, encontrado en el mismo directorio que este archivo. Da a la importación el nombre de `subtract`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should properly import `subtract` from `math_functions.js`.
|
||||
Debes importar correctamente `subtract` de `math_functions.js`.
|
||||
|
||||
```js
|
||||
assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b8c367417b2b2512b55
|
||||
title: Reuse JavaScript Code Using import
|
||||
title: Reutiliza código de JavaScript utilizando import
|
||||
challengeType: 1
|
||||
forumTopicId: 301208
|
||||
dashedName: reuse-javascript-code-using-import
|
||||
@ -8,15 +8,15 @@ dashedName: reuse-javascript-code-using-import
|
||||
|
||||
# --description--
|
||||
|
||||
`import` allows you to choose which parts of a file or module to load. In the previous lesson, the examples exported `add` from the `math_functions.js` file. Here's how you can import it to use in another file:
|
||||
`import` te permite elegir qué partes de un archivo o módulo cargar. En la lección previa, los ejemplos exportaron `add` del archivo `math_functions.js`. Así es como puedes importarlo para utilizarlo en otro archivo:
|
||||
|
||||
```js
|
||||
import { add } from './math_functions.js';
|
||||
```
|
||||
|
||||
Here, `import` will find `add` in `math_functions.js`, import just that function for you to use, and ignore the rest. The `./` tells the import to look for the `math_functions.js` file in the same folder as the current file. The relative file path (`./`) and file extension (`.js`) are required when using import in this way.
|
||||
Aquí, `import` encontrará `add` en `math_functions.js`, importa sólo esa función para que la uses, e ignora el resto. El `./`, dice a import que busque el archivo `math_functions.js` en la misma carpeta que el archivo actual. La ruta relativa del archivo (`./`) y la extensión del archivo (`.js`), son requeridos cuando se utiliza import de esta manera.
|
||||
|
||||
You can import more than one item from the file by adding them in the `import` statement like this:
|
||||
Puedes importar más de un elemento del archivo, añadiéndolos en la declaración `import` de esta manera:
|
||||
|
||||
```js
|
||||
import { add, subtract } from './math_functions.js';
|
||||
@ -24,11 +24,11 @@ import { add, subtract } from './math_functions.js';
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the appropriate `import` statement that will allow the current file to use the `uppercaseString` and `lowercaseString` functions you exported in the previous lesson. These functions are in a file called `string_functions.js`, which is in the same directory as the current file.
|
||||
Agrega la declaración `import` apropiada que permita al archivo actual, usar las funciones `uppercaseString` y `lowercaseString` que exportaste de la lección previa. Estas funciones se encuentran en un archivo llamado `string_functions.js`, el cual está en el mismo directorio que el archivo actual.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should properly import `uppercaseString`.
|
||||
Debes importar `uppercaseString` apropiadamente.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -38,7 +38,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
You should properly import `lowercaseString`.
|
||||
Debes importar `lowercaseString` apropiadamente.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b8c367417b2b2512b57
|
||||
title: Use * to Import Everything from a File
|
||||
title: Use * para importar todo de un archivo
|
||||
challengeType: 1
|
||||
forumTopicId: 301210
|
||||
dashedName: use--to-import-everything-from-a-file
|
||||
@ -8,13 +8,13 @@ dashedName: use--to-import-everything-from-a-file
|
||||
|
||||
# --description--
|
||||
|
||||
Suppose you have a file and you wish to import all of its contents into the current file. This can be done with the `import * as` syntax. Here's an example where the contents of a file named `math_functions.js` are imported into a file in the same directory:
|
||||
Supongamos que tienes un archivo y deseas importar todo su contenido en el archivo actual. Esto puede hacerse con la sintaxis `import * as`. Este es un ejemplo donde los contenidos de un archivo llamado `math_functions.js` son importados a un archivo dentro del mismo directorio:
|
||||
|
||||
```js
|
||||
import * as myMathModule from "./math_functions.js";
|
||||
```
|
||||
|
||||
The above `import` statement will create an object called `myMathModule`. This is just a variable name, you can name it anything. The object will contain all of the exports from `math_functions.js` in it, so you can access the functions like you would any other object property. Here's how you can use the `add` and `subtract` functions that were imported:
|
||||
La anterior declaración `import`, crea un objeto llamado `myMathModule`. Esto es, sólo el nombre de una variable, puedes nombrarlo de cualquier manera. El objeto contiene todas las exportaciones de `math_functions.js`, así puedes acceder a las funciones, como haces con cualquier propiedad del objeto. A continuación puedes usar las funciones importadas `add` y `subtract`:
|
||||
|
||||
```js
|
||||
myMathModule.add(2,3);
|
||||
@ -23,11 +23,11 @@ myMathModule.subtract(5,3);
|
||||
|
||||
# --instructions--
|
||||
|
||||
The code in this file requires the contents of the file: `string_functions.js`, that is in the same directory as the current file. Use the `import * as` syntax to import everything from the file into an object called `stringFunctions`.
|
||||
El código actual, requiere los contenidos del archivo: `string_functions.js`, ubicado en el mismo directorio que el archivo actual. Usa la sintaxis `import * as`, para importar todo del archivo, en un objeto llamado `stringFunctions`.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your code should properly use `import * as` syntax.
|
||||
Tu código debe utilizar apropiadamente la sintaxis `import * as`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
Reference in New Issue
Block a user