Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
, "LOOPING THROUGH ARRAYS": "RECORRIENDO ARRAYS"
, "OBJECTS": "OBJETOS"
, "OBJECT PROPERTIES": "PROPIEDADES DE OBJETOS"
, "OBJECT KEYS": "LLAVES/KEYS DE OBJETOS"
, "FUNCTIONS": "FUNCIONES"
, "FUNCTION ARGUMENTS": "ARGUMENTOS DE FUNCIONES"
, "SCOPE": "CONTEXTO"
Expand Down
49 changes: 46 additions & 3 deletions problems/object-keys/problem_es.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
---
JavaScript nos da una manera nativa de listar _todas_ las _llaves_ (_keys_) de
un objeto. Esto puede ser muy útil para iterar sobre las propiedades de un
objeto y manipular sus valores.

#
Veámos un ejemplo de cómo podríamos listar todas las propiedades de un objeto
usando el método **Object.keys()**:

---
```js
const car = {
make: 'Toyota',
model: 'Camry',
year: 2020
};
const keys = Object.keys(car);

console.log(keys);
```

El código de arriba imprime una arreglo de _strings_, donde cada _string_ es una
_llave_ (_key_) en el objeto `car` (`['make', 'model', 'year']`).

## El reto:

Crea un archivo llamado `object-keys.js`.

En ese archivo, define una variable llamada `car`:

```js
const car = {
make: 'Honda',
model: 'Accord',
year: 2020
};
```

Después define otra variable llamada `keys`:

```js
const keys = Object.keys(car);
```

Usa `console.log()` para imprimir la variable `keys` a la consola.

Comprueba si tu programa es correcto ejecutando el siguiente comando:

```bash
javascripting verify object-keys.js
```
8 changes: 7 additions & 1 deletion problems/object-keys/solution_es.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
---

#
# CORRECTO.

Buen trabajo usando el método Object.keys(). Recuerda usarlo cuando necesites listar las propiedades de un objeto.

El próximo ejercicio trabajaremos con **funciones**.

Ejecuta `javascripting` en la consola para seleccionar el siguiente ejercicio.

---