diff --git a/exercises/04.1-Print-the-last-one/README.es.md b/exercises/04-Print-the-last-one/README.es.md similarity index 100% rename from exercises/04.1-Print-the-last-one/README.es.md rename to exercises/04-Print-the-last-one/README.es.md diff --git a/exercises/04.1-Print-the-last-one/README.md b/exercises/04-Print-the-last-one/README.md similarity index 100% rename from exercises/04.1-Print-the-last-one/README.md rename to exercises/04-Print-the-last-one/README.md diff --git a/exercises/04.1-Print-the-last-one/app.js b/exercises/04-Print-the-last-one/app.js similarity index 100% rename from exercises/04.1-Print-the-last-one/app.js rename to exercises/04-Print-the-last-one/app.js diff --git a/exercises/04.1-Print-the-last-one/solution.hide.js b/exercises/04-Print-the-last-one/solution.hide.js similarity index 100% rename from exercises/04.1-Print-the-last-one/solution.hide.js rename to exercises/04-Print-the-last-one/solution.hide.js diff --git a/exercises/04.1-Print-the-last-one/tests.js b/exercises/04-Print-the-last-one/tests.js similarity index 100% rename from exercises/04.1-Print-the-last-one/tests.js rename to exercises/04-Print-the-last-one/tests.js diff --git a/exercises/08.2-Count-On/README.md b/exercises/08.2-Count-On/README.md index da90d892..6d1bc8cd 100644 --- a/exercises/08.2-Count-On/README.md +++ b/exercises/08.2-Count-On/README.md @@ -2,7 +2,7 @@ As you saw in the last exercise your array can be a mix types of data. -## :pencil: Instructions +## :pencil: Instrucciones: 1. Add all the items with data-type object into the `hello` array. @@ -17,7 +17,7 @@ for(let index = 0; index < myArray.length; index++){ } ``` -## :bulb: Hint +## :bulb: Hint: + Loop the given array. @@ -25,4 +25,4 @@ for(let index = 0; index < myArray.length; index++){ + If the item is an object, added to the `hello` array. -+ Console log the array hello. ++ Console log the array `hello`. diff --git a/exercises/08.3-Sum-all-items/README.es.md b/exercises/08.3-Sum-all-items/README.es.md index 15160688..2a00447c 100644 --- a/exercises/08.3-Sum-all-items/README.es.md +++ b/exercises/08.3-Sum-all-items/README.es.md @@ -1,17 +1,25 @@ -# `08.3` Sum All Items +# `08.3` Suma todos los elementos -Usando el bucle (loop) for, complete el código de la función `sum` para que devuelva la suma de todos los elementos en un arreglo dado, por ejemplo: +## :pencil: Instrucciones: + + +1. Usando un bucle (loop) `for`, completa el código de la función `sum` para que devuelva la suma de todos los elementos en un arregloarrayy dado, por ejemplo: ```js console.log(sumTheElements([2,13,34,5])) -//this should print 54 +//el resultado debiese ser 54 ``` -El resultado debe ser 925960 +### Resultado esperado: + + 925960 + +# :bulb: Pista: + ++ Inicializa una variable `total` en 0. + ++ Recorre todo el arreglo. -# :bulb: Pista ++ En cada bucle, agrega el valor de cada elemento en la variable `total`. -1. Inicialice una variable `total` en 0. -2. Recorre todo el arreglo. -3. En cada bucle, agregue el valor de cada elemento en la variable `total`. -4. Devuelve la variable total (fuera del bucle pero dentro de la función). \ No newline at end of file ++ Devuelve la variable `total` (fuera del bucle pero dentro de la función). \ No newline at end of file diff --git a/exercises/08.3-Sum-all-items/README.md b/exercises/08.3-Sum-all-items/README.md index 9425d965..0442a3a6 100644 --- a/exercises/08.3-Sum-all-items/README.md +++ b/exercises/08.3-Sum-all-items/README.md @@ -1,17 +1,24 @@ # `08.3` Sum All Items -Using a for loop, complete the code of the function `sum` so that it returns the sum of all the items in a given array, for example: +## :pencil: Instructions: + +Using a `for` loop, complete the code of the function `sum` so that it returns the sum of all the items in a given array, for example: ```js console.log(sumTheElements([2,13,34,5])) //this should print 54 ``` -The result should be 925960 +### Expected result: + +925960 + +# :bulb: Hint: + ++ Initilize a variable `total` at 0. + ++ Loop the entire array. -# :bulb: Hint ++ On every loop add the value of each item into the `total` variable. -1. Initilize a variable `total` at 0. -2. Loop the entire array. -3. On every loop add the value of each item into the `total` variable. -4. Return the total variable (outside of the loop but inside of the function). \ No newline at end of file ++ Return the `total` variable (outside of the loop but inside of the function). \ No newline at end of file diff --git a/exercises/09-forEach-loop/README.es.md b/exercises/09-forEach-loop/README.es.md new file mode 100644 index 00000000..852fcad3 --- /dev/null +++ b/exercises/09-forEach-loop/README.es.md @@ -0,0 +1,26 @@ +# `09.1` Bucle/loop forEach + +En lugar de usar la clásica declaración `for`, hay una nueva forma de recorrer los arreglos: [ higher order functions (funciones de orden superior) ](https://www.youtube.com/watch?v=rRgD1yVwIvE) + +Es posible recorrer un arreglo usando la función `array.forEach`. Debes especificar qué hacer en cada iteración del bucle. + +```js +myArray.forEach(function(item, index, arr){ + +}); +/** + * item: valor del elemento específico (requerido). + * index: índice del elemento (opcional). + * arr: objeto array al cual pertenece el elemento (opcional). +*/ +``` + +## :pencil: Instrucciones: + +En este momento, el código está imprimiendo todos los elementos en el arreglo o array: + +1. Cambia el código de la función para imprimir solo los números divisibles por 14. + +## :bulb: Pista: + +Un número X es divisible por 2 si: (X%2===0) \ No newline at end of file diff --git a/exercises/09.1-forEach-loop/README.md b/exercises/09-forEach-loop/README.md similarity index 53% rename from exercises/09.1-forEach-loop/README.md rename to exercises/09-forEach-loop/README.md index 6fdf0de3..897dfdd9 100644 --- a/exercises/09.1-forEach-loop/README.md +++ b/exercises/09-forEach-loop/README.md @@ -5,20 +5,24 @@ Instead of using the classic `for` statement, there is a new way to loop arrays It is possible to loop an array using the `array.forEach` function. You have to specify what to do on each iteration of the loop. ```js -/** - * item: will be the value of the specific item. - * index: will be the item index. - * arr: will be the -*/ myArray.forEach(function(item, index, arr){ }); +/** + * item: will be the value of the specific item (required). + * index: will be the item index(optional). + * arr: will be the array object to which the element belongs to (opcional). +*/ + + ``` -# :pencil: Instructions +## :pencil: Instructions: + +Right now, the code is printing all the items in the array: -Right now, the code is printing all the items in the array. Please change the function code to print only the numbers divisible by 14. +1. Please change the function code to print only the numbers divisible by 14. -## :bulb: HINT +## :bulb: Hint: A number X is divisible by 2 if: (X%2===0) \ No newline at end of file diff --git a/exercises/09.1-forEach-loop/app.js b/exercises/09-forEach-loop/app.js similarity index 100% rename from exercises/09.1-forEach-loop/app.js rename to exercises/09-forEach-loop/app.js diff --git a/exercises/09.1-forEach-loop/tests.js b/exercises/09-forEach-loop/tests.js similarity index 100% rename from exercises/09.1-forEach-loop/tests.js rename to exercises/09-forEach-loop/tests.js diff --git a/exercises/09.1-forEach-loop/README.es.md b/exercises/09.1-forEach-loop/README.es.md deleted file mode 100644 index b25d2d8e..00000000 --- a/exercises/09.1-forEach-loop/README.es.md +++ /dev/null @@ -1,24 +0,0 @@ -# `09.1` forEach Loop - -En lugar de usar la clásica declaración `for`, hay una nueva forma de recorrer los arreglos llamados [(funciones de orden superior) higher order functions](https://www.youtube.com/watch?v=rRgD1yVwIvE) - -Es posible recorrer un arreglo usando la función `array.forEach`. Debes especificar qué hacer en cada iteración del bucle. - -```js -/** - * item: will be the value of the specific item. - * index: will be the item index. - * arr: will be the -*/ -myArray.forEach(function(item, index, arr){ - -}); -``` - -# :pencil: Instrucciones - -En este momento, el código está imprimiendo todos los elementos en el arreglo. Cambia el código de la función para imprimir solo los números divisibles por 14. - -## :bulb: Pista - -Un número X es divisible por 2 si: (X%2===0) \ No newline at end of file diff --git a/exercises/10-Everything-is-awesome/README.es.md b/exercises/10-Everything-is-awesome/README.es.md new file mode 100644 index 00000000..543efe8c --- /dev/null +++ b/exercises/10-Everything-is-awesome/README.es.md @@ -0,0 +1,13 @@ +# `10` Todo es increíble + +## 📝 Instrucciones: + +1. Compara el elemento. Si es `1`, pone el número en el arreglo `return_array`. + +2. Compara el elemento si es `0`, pone "Yahoo" en el arreglo o array `return_array` (en lugar del número) + +Ejemplo de la salida para [0,0,1,1,0]: + +```bash +['Yahoo','Yahoo','1','1','Yahoo'] +``` \ No newline at end of file diff --git a/exercises/10-Everything-is-awesome/README.md b/exercises/10-Everything-is-awesome/README.md new file mode 100644 index 00000000..964c11a7 --- /dev/null +++ b/exercises/10-Everything-is-awesome/README.md @@ -0,0 +1,13 @@ +# `10` Everything is awesome + +# 📝 Instructions: + +1. Compare the item. If it is `1` push the number to the array `return_array`. + +2. Compare the item if it is 0 push "Yahoo" to the array `return_array` (instead of the number) + +Example output for [0,0,1,1,0]: + +```bash +['Yahoo','Yahoo','1','1','Yahoo'] +``` \ No newline at end of file diff --git a/exercises/10.1-Everything-is-awesome/app.js b/exercises/10-Everything-is-awesome/app.js similarity index 100% rename from exercises/10.1-Everything-is-awesome/app.js rename to exercises/10-Everything-is-awesome/app.js diff --git a/exercises/10.1-Everything-is-awesome/test.js b/exercises/10-Everything-is-awesome/test.js similarity index 100% rename from exercises/10.1-Everything-is-awesome/test.js rename to exercises/10-Everything-is-awesome/test.js diff --git a/exercises/10.1-Everything-is-awesome/README.es.md b/exercises/10.1-Everything-is-awesome/README.es.md deleted file mode 100644 index 5c3e94a6..00000000 --- a/exercises/10.1-Everything-is-awesome/README.es.md +++ /dev/null @@ -1,13 +0,0 @@ -# `10.1` Everything is awesome - -## 📝 Instrucciones - -Compara el elemento si es 1, inserta el número en el arreglo return_array - -Compara el elemento si es 0, introduce "Yahoo" en el arreglo return_array (en lugar del número) - -Ejemplo de la salida para [0,0,1,1,0]: - -```bash -['Yahoo','Yahoo','1','1','Yahoo'] -``` \ No newline at end of file diff --git a/exercises/10.1-Everything-is-awesome/README.md b/exercises/10.1-Everything-is-awesome/README.md deleted file mode 100644 index 906572a3..00000000 --- a/exercises/10.1-Everything-is-awesome/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# `10.1` Everything is awesome - -# 📝 Instructions - -Compare the item if it is 1 push the number to the array return_array - -Compare the item if it is 0 push "Yahoo" to the array return_array (instead of the number) - -Example output for [0,0,1,1,0]: - -```bash -['Yahoo','Yahoo','1','1','Yahoo'] -``` \ No newline at end of file diff --git a/exercises/11-Do-while/README.es.md b/exercises/11-Do-while/README.es.md index 2a80f1d2..338b85cc 100644 --- a/exercises/11-Do-while/README.es.md +++ b/exercises/11-Do-while/README.es.md @@ -1,27 +1,28 @@ # `11` DO DO DO -El do{}while(); es otro ejemplo de bucle(loop) en javascript que se usa con menos frecuencia pero es un bucle +El `do{}while()`; es otro ejemplo de bucle(loop) en javascript que se usa con menos frecuencia pero es un bucle. ```js -// stating value for the loop: +// declarando el valor para el loop o bucle: let i = 0; -// the loop will do everything inside of the do code block +// el loop hará todo dentro del bloque de código do { - // print out the i value + // imprime el valor de i console.log(i) - // increase the i value + // aumenta el valor de i i++ - // evaluate the value + // evalúa el valor de i } while (i < 5); ``` -# 📝 Instrucciones +## 📝 Instrucciones: -Imprima cada número de iteración en la consola del 20 al 0, pero concatene un signo de exclamación a la salida si el número es un multiplo de 5 -Al final console.log () "LIFTOFF" +1. Imprime cada número de la iteración en la consola del 20 al 0, pero concaténale un signo de exclamación(`!`) al elemento si el número es un multiplo de 5. -Example Output on the console: +2. Al final haz un `console.log()`de "LIFTOFF" + +### Resultado esperado: ```md 20! diff --git a/exercises/11-Do-while/README.md b/exercises/11-Do-while/README.md index 215c24d7..544a046e 100644 --- a/exercises/11-Do-while/README.md +++ b/exercises/11-Do-while/README.md @@ -1,6 +1,6 @@ # `11` DO DO DO -The do{}while(); is another loop example in javascript is less commonly used but it is a loop +The `do{}while()`; is another loop example in javascript is less commonly used but it is a loop. ```js // stating value for the loop: @@ -12,16 +12,17 @@ do { console.log(i) // increase the i value i++ - // evaluate the value + // evaluate the value of i } while (i < 5); ``` -# 📝 Instructions +## 📝 Instructions: -Print every iteration number on the console from 20 to 0 but concatenate an exclamation point to the output if the number is a module of 5 -At the end console.log() "LIFTOFF" +1. Print every iteration number on the console from 20 to 0 but concatenate an exclamation point to the output if the number is a module of 5. -Example Output on the console: +2. At the end `console.log()`de LIFTOFF" + +### Expected result: ```md 20! diff --git a/exercises/12-Delete-element/README.es.md b/exercises/12-Delete-element/README.es.md index 279a4fea..98d24607 100644 --- a/exercises/12-Delete-element/README.es.md +++ b/exercises/12-Delete-element/README.es.md @@ -1,4 +1,17 @@ -La única forma de eliminar a Daniella del arreglo (sin hacer trampa) será crear un nuevo arreglo con todas las demás personas, excepto Daniella. +# `12` Eliminar el elemento -Instrucciones -Crea una función deletePerson que elimine a cualquier persona del arreglo y devuelve un nuevo arreglo sin esa persona. \ No newline at end of file +La única forma de eliminar a `Daniella` del array o arreglo (sin hacer trampa) será crear un nuevo arreglo con todas las demás personas, excepto Daniella. + +## 📝Instrucciones: + +1. Crea una función `deletePerson` que elimine a cualquier persona del arreglo y devuelva un nuevo arreglo sin esa persona. + +### Resultado esperado: + + + ```js + + ['juan', 'ana', 'michelle', 'stefany', 'lucy', 'barak'] +['ana', 'michelle', 'daniella', 'stefany', 'lucy', 'barak'] +['juan', 'ana', 'michelle', 'daniella', 'stefany', 'lucy', 'barak'] +``` diff --git a/exercises/12-Delete-element/README.md b/exercises/12-Delete-element/README.md index 15f9bb80..8f7db68e 100644 --- a/exercises/12-Delete-element/README.md +++ b/exercises/12-Delete-element/README.md @@ -1,15 +1,15 @@ # `12` Delete element -The only way to delete `Daniella` from the list (without cheating) -will be to create a new list with all the other people but Daniella. +The only way to delete `Daniella` from the array (without cheating) will be to create a new list with all the other people but Daniella. -# 📝Instructions -1. Please create a `deletePerson` function that deletes any given person from the list - and returns a new list without that person. +## 📝Instructions: +1. Please create a `deletePerson` function that deletes any given person from the array and returns a new array without that person. + +### Expected result: ```js - Result: + ['juan', 'ana', 'michelle', 'stefany', 'lucy', 'barak'] ['ana', 'michelle', 'daniella', 'stefany', 'lucy', 'barak'] ['juan', 'ana', 'michelle', 'daniella', 'stefany', 'lucy', 'barak'] diff --git a/exercises/13-Merge-arrays/README.es.md b/exercises/13-Merge-arrays/README.es.md index 32dcbdd9..23d27c61 100644 --- a/exercises/13-Merge-arrays/README.es.md +++ b/exercises/13-Merge-arrays/README.es.md @@ -1,7 +1,18 @@ -Como vivimos en un mundo nuevo, no debería haber colores ni etiquetas, ¿verdad? +# `13` Merge array: -Instrucciones -Escribe una función que combine dos arreglos y retorne un único arreglo nuevo que combine todos los valores de ambos arreglos. +Como vivimos en un mundo nuevo, no debería haber colores ni etiquetas, ¿cierto? -Pista: -Tendrás que recorrer cada arreglo e insertar sus elementos en un nuevo arreglo. \ No newline at end of file +## 📝Instrucciones: + +1. Escribe una función que combine dos arreglos y retorne un único arreglo nuevo que combine todos los valores de ambos arreglos. + +### Resultado esperado: + +```js + + ['Lebron', 'Aaliyah', 'Diamond', 'Dominique', 'Aliyah', 'Jazmin', 'Darnell', 'Lucas', 'Jake', 'Scott', 'Amy', 'Molly', 'Hannah', 'Lucas'] +``` + +### 💡 Pista: + ++ Tendrás que recorrer cada arreglo e insertar sus elementos en un nuevo arreglo. \ No newline at end of file diff --git a/exercises/13-Merge-arrays/README.md b/exercises/13-Merge-arrays/README.md index 7acccf35..32879bca 100644 --- a/exercises/13-Merge-arrays/README.md +++ b/exercises/13-Merge-arrays/README.md @@ -1,14 +1,18 @@ -# `13` Merge array: +# `13` Uniendo arrays: Since we live in a new world, there should be no colors or labels, right? -# 📝Instructions -Write a function that merges two array and returns a single new array with all the items from both arrays inside. +## 📝Instructions: + +1. Write a function that merges two array and returns a single new array with all the items from both arrays inside. + +### Expected result: ```js -// The console output expected: + ['Lebron', 'Aaliyah', 'Diamond', 'Dominique', 'Aliyah', 'Jazmin', 'Darnell', 'Lucas', 'Jake', 'Scott', 'Amy', 'Molly', 'Hannah', 'Lucas'] ``` -💡HINT: -- You will have to loop though each array and insert their items into a new array. \ No newline at end of file +### 💡 Hint: + ++ You will have to loop though each array and insert their items into a new array. \ No newline at end of file diff --git a/exercises/14-Divide-and-Conquer/README.es.md b/exercises/14-Divide-and-Conquer/README.es.md index 54708cec..2a26038e 100644 --- a/exercises/14-Divide-and-Conquer/README.es.md +++ b/exercises/14-Divide-and-Conquer/README.es.md @@ -1,19 +1,28 @@ -# Instrucciones -- Crea una función llamada mergeTwoList que reciba un arreglo de números (enteros). -- Recorre el arreglo y separa los números pares e impares en diferentes arreglos. -- Si el número es impar, envíalo a un arreglo denominado odd. -- Si el número es par, envíalo a un arreglo denominado even. -- Luego concatena el arreglo odd al arreglo even para combinarlos. +# `14` Divide y conquista -> Recuerda que el arreglo `odd` va primero y luego debes agregar lots items del arreglo `even`. +## 📝 Instrucciones: -## Example: +1. Crea una función llamada `mergeTwoList` que reciba un arreglo de números (enteros). + +2. Recorre el arreglo y separa los números pares e impares en diferentes arreglos. + +3. Si el número es impar, envíalo a un arreglo denominado `odd`. + +4. Si el número es par, envíalo a un arreglo denominado `even`. + +5. Luego concatena el arreglo `odd` al arreglo `even` para combinarlos. + +> Recuerda que el arreglo `odd` va primero y luego debes agregar los items del arreglo `even`. + +Ejemplo: ```js mergeTwoList([1,2,33,10,20,4]); +// resultado esperado en la consola: [1, 33, 2, 10, 20, 4] ``` -### Pista: -Cree variables vacías cuando necesites almacenar datos. \ No newline at end of file +### 💡 Pista: + ++ Crea variables vacías cuando necesites almacenar datos. \ No newline at end of file diff --git a/exercises/14-Divide-and-Conquer/README.md b/exercises/14-Divide-and-Conquer/README.md index 5da2a60a..4c7c2b43 100644 --- a/exercises/14-Divide-and-Conquer/README.md +++ b/exercises/14-Divide-and-Conquer/README.md @@ -1,22 +1,28 @@ -# `14` Divide and conquer: +# `14` Divide and conquer + +## 📝 Instructions: -## 📝Instructions 1. Create a function called `mergeTwoList` that expects an array of numbers (integers). -2. Loop through the array and separate the odd and the even numbers in different lists. -3. If the number is odd number push it to a placeholder array named odd. -4. If the number is even number push it to a placeholder array named even. + +2. Loop through the array and separate the odd and the even numbers in different arrays. + +3. If the number is odd number push it to a placeholder array named `odd`. + +4. If the number is even number push it to a placeholder array named `even`. + 5. Then concatenate the `odd` array to the `even` array (combine them). -> Remember, the odd array comes first and you have to append the even mergeTwoList. +> Remember, the `odd` array comes first and you have to append the `even`. + +Ejemplo: ```js -Example: mergeTwoList([1,2,33,10,20,4]) // expected console output [1, 33, 2, 10, 20, 4] ``` -### 💡 Hints: +### 💡 Hint: -Create empty(placeholder) variables when you need to store data. \ No newline at end of file ++ Create empty(placeholder) variables when you need to store data. \ No newline at end of file diff --git a/exercises/15-Max-integer-from-array/README.es.md b/exercises/15-Max-integer-from-array/README.es.md index 1a66867b..b6a07351 100644 --- a/exercises/15-Max-integer-from-array/README.es.md +++ b/exercises/15-Max-integer-from-array/README.es.md @@ -1,8 +1,21 @@ -El máximo número entero dentro del arreglo +# `15` El máximo número entero dentro del arreglo -Escribe un script que encuentre el número entero más grande en myArray e imprima ese número en la consola con la función console.log. +## 📝Instrucciones: -Pista: -Define una variable auxiliar y establezca el primer valor en 0, luego compara las variables con todos los elementos del arreglo. Reemplaza el valor cada vez que el nuevo elemento sea más grande que el almacenado en la variable auxiliar. Al final tendrá el mayor número almacenado en la variable. +1. Escribe un script que encuentre el número entero más grande en `myArray`. -Su resultado debe ser 5435. \ No newline at end of file +2. Imprime ese número en la consola con la función `console.log()`. + +### 💡 Pista: + +- Define una variable auxiliar y establece el primer valor en 0, + +- Luego compara las variables con todos los elementos del arreglo. + +- Reemplaza el valor cada vez que el nuevo elemento sea más grande que el almacenado en la variable auxiliar. + +- Al final tendrá el mayor número almacenado en la variable. + +### Resultado esperado: + + 5435 \ No newline at end of file diff --git a/exercises/15-Max-integer-from-array/README.md b/exercises/15-Max-integer-from-array/README.md index 1940b566..74bd3a21 100644 --- a/exercises/15-Max-integer-from-array/README.md +++ b/exercises/15-Max-integer-from-array/README.md @@ -1,16 +1,22 @@ -# `15` Max integer from my_list +# `15` Max integer from the array -# 📝Instructions -1. Write a script that finds the biggest integer in list +## 📝Instructions: + +1. Write a script that finds the biggest integer in `Myarray`. + 2. Print that number in the console with the `console.log()` function. -💡Hint: +### 💡 Hint: + - Define an auxiliar variable and set the first value to 0. + - Then compare the variables with all the items in the list. + - Replace the value every time the new element is bigger than the one stored in the auxiliar variable. + - At the end you will have the biggest number stored in the variable. - ```js -Your result should be 5435. -``` \ No newline at end of file +### Expected result: + + 5435 diff --git a/exercises/16-Foreach-min-val/README.es.md b/exercises/16-Foreach-min-val/README.es.md index 718bb224..400eff5e 100644 --- a/exercises/16-Foreach-min-val/README.es.md +++ b/exercises/16-Foreach-min-val/README.es.md @@ -1,18 +1,32 @@ -Es posible atravesar una arreglo usando la función array.forEach; debes especificar qué hacer en cada iteración del bucle. +# `16` Número entero menor: -//item will be the value of the specific item. -//index will be the item index. -//arr will be the -myArray.forEach(function(item, index, arr){ - console.log(item, index); +Es posible recorrero una arreglo usando la función `array.forEach`. Debes especificar qué hacer en cada iteración del bucle. +```js +myArray.forEach(function(item, index, arr){ + console.log(item, index) +//item es el valor específico del elemento. +//index será el índice del elemento. +//arr será el array al cual pertenece el elemento. }); -Instrucciones -Utiliza la función forEach para obtener el valor mínimo del arreglo e imprimirlo en la consola. -Pista -1) Declarar una variable global auxiliar -2) Establece un valor de un entero muy grande -3) Cada vez que realices un loop(bucle), compara su valor con el valor del elemento, si el valor del elemento es menor, actualiza el valor de la variable auxiliar al valor del elemento. -4) Fuera del bucle, una vez finalizado el bucle, imprima el valor auxiliar. +``` +## 📝 Instrucciones: + +1. Utiliza la función `forEach` para obtener el valor mínimo del arreglo e imprimirlo en la consola. + +### 💡 Pista: + +- Declarar una variable global auxiliar + +- Establece un valor de un número entero muy grande. + +- Cada vez que realices un loop(bucle), compara su valor con el valor del numero entero grande, si el valor del elemento es menor, actualiza el valor de la variable auxiliar al valor del elemento. + +- Fuera del bucle, una vez finalizado el bucle, imprima el valor auxiliar. + +### Resultado esperado: + +23 + diff --git a/exercises/16-Foreach-min-val/README.md b/exercises/16-Foreach-min-val/README.md index a3a8b889..fd774d9a 100644 --- a/exercises/16-Foreach-min-val/README.md +++ b/exercises/16-Foreach-min-val/README.md @@ -1,28 +1,37 @@ + # `16` Minimum integer: -It is possible to traverse an array using the array.forEach function. -You have to specify what to do on each iteration of the loop. +It is possible to traverse an array using the `array.forEach` function. You have to specify what to do on each iteration of the loop. ```js + +myArray.forEach(function(item, index){ + console.log(item, index) //item will be the value of the specific item. //index will be the item index. -myArray.forEach(function(item, index){ - console.log(item, index); - +//arr will be the array object to which the element belongs to. }); + + ``` -# 📝Instructions -1. Please use the forEach function to get the minimum value of the array and print it in the console. +## 📝 Instructions: + +1. Please use the `forEach` function to get the minimum value of the array and print it in the console. + +### 💡 Hint: -## 💡Hints: - Declare an auxiliar global variable + - Set its value to a very big integer + - Every time you loop compare its value to the item value, if the item value is smaller update the auxiliar variable value to the item value. + - Outside of the loop, after the loop is finished, print the auxiliar value. -```js -expected: 23 -``` \ No newline at end of file + +### Expected result: + + 23 diff --git a/exercises/17-The-for-loop/README.es.md b/exercises/17-The-for-loop/README.es.md index bf864aa8..da9b4e1b 100644 --- a/exercises/17-The-for-loop/README.es.md +++ b/exercises/17-The-for-loop/README.es.md @@ -1,11 +1,23 @@ -Otra forma de recorrer un arreglo con el loop for es usando la instrucción IN de esta manera: +# `17` Un For Loop para encontrar un promedio +Otra forma de recorrer un arreglo con el loop `for` es usando la declaración`in` de esta manera: + +```js for (var index in myArray){ console.log(myArray[index]); } +``` + +## 📝 Instrucciones: + +1. Calcula el valor promedio de todos los elementos del arreglo. + +2. Imprímelo en la consola. + +### 💡 Pista: + +Para imprimir el promedio, debes sumar todos los valores y dividir el resultado por la longitud (length) total del arreglo. -Instrucciones -Calcula el valor promedio de todos los elementos del arreglo e imprímalo en la consola. +### Resultado esperado: -Pista: -Para imprimir el promedio, debes agregar todos los valores y dividir el resultado por la longitud total del arreglo. \ No newline at end of file +27278.8125 \ No newline at end of file diff --git a/exercises/17-The-for-loop/README.md b/exercises/17-The-for-loop/README.md index 8377b4a0..f1072f7b 100644 --- a/exercises/17-The-for-loop/README.md +++ b/exercises/17-The-for-loop/README.md @@ -1,21 +1,27 @@ # `17` The For Loop Find average -Another way to loop an array with the for loop will be using the IN statement like this: +Another way to loop an array with the `for` loop will be using the `in` statement like this: + ```js for (var index in myArray){ console.log(myArray[index]); } ``` -# 📝Instructions -1. Declare a variable with value 0. +## 📝 Instructions: -## #$# 💡HINT: -To print the average, you have to add all the values and divide the result -by the total length of the list. +1. Calculate the average value of all the items in the array + +2. Print it on the console. + +### 💡 Hint: + +To print the average, you have to add all the values and divide the result by the total length of the list. + + +### Expected result: -```js -// The result should be: 27278.8125 -Calculate the average value of all the items in the array and print it on the console. + + diff --git a/exercises/18-Nested-arrays/README.es.md b/exercises/18-Nested-arrays/README.es.md index 7565e773..c05d5712 100644 --- a/exercises/18-Nested-arrays/README.es.md +++ b/exercises/18-Nested-arrays/README.es.md @@ -1,18 +1,21 @@ +# `18` Arrays/arreglos anidados + Es posible encontrar un arreglo compuesto por otros arreglos (se llama arreglo o arreglo de dos dimensiones). -En este ejemplo, tenemos una serie de coordenadas a las que puedes acceder haciendo lo siguiente: +En este ejemplo, tenemos una array o arreglo de coordenadas a las que puedes acceder haciendo lo siguiente: ```js -//The first coordinate latitude +//la primera coordenada latitud var latitude = coordinatesArray[0][0]; -//The first coordinate longitude +//la primera coordenada longitud var longitude = coordinatesArray[0][1]; ``` -Instrucciones: -Recorre el arreglo imprimiendo solo las longitudes. +## 📝 Instruciones: + +1. Recorre el arreglo(con un bucle) imprimiendo solo las longitudes. -El resultado debería ser algo como esto: +### Resultado esperado: ```md -112.633853 diff --git a/exercises/18-Nested-arrays/README.md b/exercises/18-Nested-arrays/README.md index 11803fb3..a132931d 100644 --- a/exercises/18-Nested-arrays/README.md +++ b/exercises/18-Nested-arrays/README.md @@ -11,10 +11,12 @@ var latitude = coordinatesArray[0][0]; var longitude = coordinatesArray[0][1]; ``` -# 📝Instructions: -Loop through the array printing only the longitudes. +## 📝 Instructions: -The result should be something like this: +1. Loop through the array printing only the longitudes. + + +### Expected Result: ```md -112.633853 diff --git a/exercises/19-And-One-and-a-Two-and-a-Three/README.es.md b/exercises/19-And-One-and-a-Two-and-a-Three/README.es.md index 700ce5f9..d83539d9 100644 --- a/exercises/19-And-One-and-a-Two-and-a-Three/README.es.md +++ b/exercises/19-And-One-and-a-Two-and-a-Three/README.es.md @@ -1,14 +1,22 @@ -Instrucciones -Dado un objeto denominado contact, repite todas sus propiedades y valores e imprímalos en la consola. -Tendrás que recorrer sus propiedades para poder imprimirlas. +# `19` Y uno y dos y tres + + +## 📝 Instrucciones: + +Dado un objeto denominado contact: + +1. Repite todas sus propiedades y valores e imprímelos en la consola. Tendrás que recorrer (con un loop) sus propiedades para poder imprimirlas. + +### Resultado esperado: -Salida de consola esperada: ```md fullname : John Doe phone : 123-123-2134 email : test@nowhere.com ``` -Pista -MDN for in loop reference +### :bulb: Pista: + +Lee sobre los bucles/loops: + https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#for...in_statement \ No newline at end of file diff --git a/exercises/19-And-One-and-a-Two-and-a-Three/README.md b/exercises/19-And-One-and-a-Two-and-a-Three/README.md index b19351aa..5bf8cbf8 100644 --- a/exercises/19-And-One-and-a-Two-and-a-Three/README.md +++ b/exercises/19-And-One-and-a-Two-and-a-Three/README.md @@ -1,9 +1,12 @@ # `19` And one and two and three -# 📝Instruction -- Given a contact object, please loop all its properties and values and print them on the console. -- You will have to loop its properties to be able to print them -Expected console output: +## 📝 Instructions: + +Given a contact object: + +1. Please loop all its properties and values and print them on the console.You will have to loop its properties to be able to print them + +### Expected result: ```md fullname : John Doe @@ -11,6 +14,8 @@ phone : 123-123-2134 email : test@nowhere.com ``` -💡Hints -MDN for in loop reference +### 💡 Hint: + +MDN for in loop reference: + https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#for...in_statement \ No newline at end of file diff --git a/exercises/20.1-Map-an-array/README.es.md b/exercises/20.1-Map-an-array/README.es.md index 94ae4403..021adaf1 100644 --- a/exercises/20.1-Map-an-array/README.es.md +++ b/exercises/20.1-Map-an-array/README.es.md @@ -1,6 +1,8 @@ -La función Array.map () es una de las funciones más utilizadas en Javascript. Es sorprendente porque te permite crear un nuevo arreglo utilizando cada elemento del arreglo original como semilla. +# `20.1` Mapea un array -En este ejemplo, estamos utilizando la función de map para crear un nuevo arreglo de horas civiles a partir de un arreglo determinado de horas militares. +La función `Array.map()` es una de las funciones más utilizadas en Javascript. Es sorprendente porque te permite crear un nuevo arreglo utilizando cada elemento del arreglo original como semilla. + +En este ejemplo, estamos utilizando la función de `map` para crear un nuevo arreglo de horas civiles a partir de un arreglo determinado de horas militares. ```js // Dado un arreglo de horas militares @@ -14,17 +16,20 @@ var militaryToCivilian = function(hour){ else return hour + "am"; } -// puedes crear una nueva hora civil mapeando el arreglo original pero pasando la función militaryToCivilian a la función map +//puedes crear una nueva hora civil mapeando el arreglo original pero pasando la función militaryToCivilian a la función map var civilianHours = militaryHours.map(militaryToCivilian); console.log(civilianHours); ``` -Copie y pegue el código dentro del editor de código para probarlo si lo desea. +Copia y pega el código dentro del editor de código para probarlo si quieres. + +## 📝 Instrucciones: + +1. Usando la misma lógica dada en el ejemplo, agrega el código necesario para convertir un arreglo de valores `Celsius` en `Fahrenheit` dentro de la función de `map`. + +## 💡 Pista: -Instrucciones -Usando la misma lógica dada en el ejemplo, agrega el código necesario para convertir un arreglo de valores Celsius en Fahrenheit dentro de la función de map. +Aquí hay un video de 3:40 min que explica la función del map: -Pista -Aquí hay un video de 3:40 min que explica la función del map https://www.youtube.com/watch?v=hfYa4ugeyuc&t=32s \ No newline at end of file diff --git a/exercises/20.1-Map-an-array/README.md b/exercises/20.1-Map-an-array/README.md index ca046b4e..50653904 100644 --- a/exercises/20.1-Map-an-array/README.md +++ b/exercises/20.1-Map-an-array/README.md @@ -1,9 +1,9 @@ # `20.1` Map an array -The Array.map() function is one of the most used functions in Javascript. +The `Array.map()` function is one of the most used functions in Javascript. It is amazing because it lets you create a new array using each item of the original array as a seed. -In this example, we are using the map function to create a new array of +In this example, we are using the `map` function to create a new array of civilian hours starting from a given array of military hours. ```js @@ -26,9 +26,12 @@ console.log(civilianHours); Copy paste the code inside the code editor to test it if you want. -# 📝Instructions: -Using the same logic given in the example, add the needed code to convert an array of Celsius values into Fahrenheit inside the map function. +## 📝 Instructions: + +1. Using the same logic given in the example, add the needed code to convert an array of `Celsius` values into `Fahrenheit` inside the `map` function. + +## 💡 Hint: + +Here is a 3:40 min video explaining the array map function: -## 💡Hints -Here is a 3:40 min video explaining the array map function https://www.youtube.com/watch?v=hfYa4ugeyuc&t=32s \ No newline at end of file diff --git a/exercises/20.2-More-mapping/README.es.md b/exercises/20.2-More-mapping/README.es.md index 4c0cf19f..18f977cc 100644 --- a/exercises/20.2-More-mapping/README.es.md +++ b/exercises/20.2-More-mapping/README.es.md @@ -1,4 +1,7 @@ +# `20.2` Sigamos "mapeando" + El método array.map llama a una función para cada valor en un arreglo y luego genera un nuevo arreglo con los valores modificados. + ```js incrementByOne = function (number) { return number + 1; @@ -6,20 +9,21 @@ incrementByOne = function (number) { var myArray = [1, 2, 3, 4]; -myArray.map(incrementByOne); //returns [2, 3, 4, 5] +myArray.map(incrementByOne); //devuelve [2, 3, 4, 5] ``` -Mas información sobre mapeo: -Mapping Arrays (3:44) -Understanding The Javascript Map -Instrucciones: +## 📝 Instrucciones: + +1. Crea una función llamada `myFunction` que multiplique cada número por 3. + +2. Usa la función `Array.map` para ejecutar la función `myFunction` a través de cada valor en el arreglo. + +3. Almacena el nuevo arreglo en una variable llamada `newArray` y luego imprimes el nuevo arreglo con `console.log()`. + +## 💡 Pista: -Crea una función llamada myFunction que multiplique cada número por 3. -Usa la función Array.map para ejecutar la función myFunction a través de cada valor enl arreglo. - Almacena el nuevo arreglo en una variable llamada newArray y luego imprimes el nuevo arreglo con console.log (). ++ La función tomará un parámetro con el elemento original que se transforma y se agrega en el nuevo arreglo. -Pista: -La función tomará un parámetro con el elemento original que se transforma y agrega en el nuevo arreglo. -Recuerda que tu función debe devolver cada uno de los nuevos elementos que se almacenarán en el nuevo arreglo. ++ Recuerda que tu función debe devolver cada uno de los nuevos elementos que se almacenarán en el nuevo arreglo. diff --git a/exercises/20.2-More-mapping/README.md b/exercises/20.2-More-mapping/README.md index b290c003..4a714640 100644 --- a/exercises/20.2-More-mapping/README.md +++ b/exercises/20.2-More-mapping/README.md @@ -1,7 +1,8 @@ # `20.2` More Mapping -The array.map method calls a function for each value in an array and +The `array.map` method calls a function for each value in an array and then outputs a new array with the modified values. + ```js incrementByOne = function (number) { return number + 1; @@ -12,14 +13,17 @@ var myArray = [1, 2, 3, 4]; myArray.map(incrementByOne); //returns [2, 3, 4, 5] ``` +## 📝 Instructions: + +1. Create a function named `myFunction` that will multiply each number by 3. + +2. Use the `array.map` function to run the `myFunction` function through each value in the array. + +3. Store the new array in a variable named `newArray` and `console.log()` the new array. -# 📝Instructions: +## 💡 Hint: -- Create a function named `myFunction` that will multiply each number by 3. -- Use the `array.map` function to run the `myFunction` function through each value in the array. -- Store the new array in a variable named `newArray` and `console.log()` the new array. ++ The function will take a parameter with the original item being transformed and added into the new array. -## 💡Hint: -The function will take a parameter with the original item being transformed and added into the new array. -Remember that your function must return each of the new items to be stored into the new array. ++ Remember that your function must return each of the new items to be stored into the new array. diff --git a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/README.es.md b/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/README.es.md deleted file mode 100644 index 39a31168..00000000 --- a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/README.es.md +++ /dev/null @@ -1,23 +0,0 @@ -Otra función sorprendente para los arreglos es el filtro. Repite toda el arreglo original y solo devuelve los valores que coinciden con una condición particular. - -[Aquí está la documentación de la función de filtro en w3school](https://www.w3schools.com/jsref/jsref_filter.asp) - -Por ejemplo, este algoritmo filtra el arreglo allNumbers y devuelve un nuevo arreglo con solo los números impares: - -```js -var allNumbers = [23,12,35,5,3,2,3,54,3,21,534,23,42,1]; - -var onlyOdds = allNumbers.filter(function(number){ - return (number % 2 > 0) -}); - -console.log(onlyOdds); -``` - -Instrucciones -Completa el código para que llene el arreglo resultante de Nombres con solo los nombres que comienzan con la letra R -Usa la función Array.filter - -Pista: -Aquí hay un video de 2:29min explicando array.filter -https://www.youtube.com/watch?v=0qsFDFC2oEE \ No newline at end of file diff --git a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/README.md b/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/README.md deleted file mode 100644 index f2fb4f4b..00000000 --- a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# `21` Filter an Array - -Another amazing function for arrays is `filter`. -It loops the entire original array and only returns the values that match a particular condition. - -[Here is the documentation of the filter function in w3school](https://www.w3schools.com/jsref/jsref_filter.asp) - -For example, this algorithm filters the `allNumbers` array and returns a new array with only the odds numbers: - -```js -var allNumbers = [23,12,35,5,3,2,3,54,3,21,534,23,42,1]; - -var onlyOdds = allNumbers.filter(function(number){ - return (number % 2 > 0) -}); - -console.log(onlyOdds); -``` - -# 📝Instructions -- Complete the code to make it fill the `resultingNames` array with only the names that start with letter R -- Use the `array.filter` function - -## 💡Hint -Here is a 2:29min video explaining array.filter -https://www.youtube.com/watch?v=0qsFDFC2oEE \ No newline at end of file diff --git a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/app.js b/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/app.js deleted file mode 100644 index c9218728..00000000 --- a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/app.js +++ /dev/null @@ -1,5 +0,0 @@ -let allNames = ["Romario","Boby","Roosevelt","Emiliy", "Michael", "Greta", "Patricia", "Danzalee"]; - -//your code here - -console.log(resultingNames); \ No newline at end of file diff --git a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/test.js b/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/test.js deleted file mode 100644 index 3ddb62f1..00000000 --- a/exercises/20.3-Map-with-function-inside-variable/21-Filter-an-array/test.js +++ /dev/null @@ -1,38 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const rewire = require("rewire"); - -let _log = console.log; -let _buffer = ''; -global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); - -const app_content = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); - -test("You should create the variable resultingNames.", function(){ - const file = rewire("./app.js"); - const myVar = file.__get__('resultingNames'); - expect(myVar).toBeTruthy(); -}); - -test('You have to use the console.log function to print the correct output.', function () { - const app = require('./app.js'); - expect(console.log.mock.calls.length > 0).toBe(true); -}); - -test('You should use the console.log to call the variable resultingNames', function () { - const file = rewire("./app.js"); - const myVar = file.__get__('resultingNames'); - expect(console.log).toHaveBeenCalledWith(myVar); - }); - -test('The output in the console should match the one in the instructions!', function () { - const _app = rewire('./app.js'); - - let _allNames = ["Romario","Boby","Roosevelt","Emiliy", "Michael", "Greta", "Patricia", "Danzalee"]; - let _test = _allNames.filter(item=>item[0] === "R") - expect(_buffer).toMatch(_test.map(n => n).join(",")); - }); - - - - diff --git a/exercises/20.3-Map-with-function-inside-variable/README.es.md b/exercises/20.3-Map-with-function-inside-variable/README.es.md index 79bc8cf5..f722a4b4 100644 --- a/exercises/20.3-Map-with-function-inside-variable/README.es.md +++ b/exercises/20.3-Map-with-function-inside-variable/README.es.md @@ -1,9 +1,14 @@ -Los nombres de las variables contienen muchos nombres (dugh ...) +# `20.3` Map con una función dentro de una variable -La función otorgada con la variable prepender devuelve todo lo que se le pasa pero se antepone con la cadena: 'Mi nombre es:' +Los `nombres` de las variables contienen muchos nombres (obviamente ...) -Instrucciones -Asigna el arreglo de nombres utilizando la función prepender para crear un nuev arreglo que se vea así: +La función almacenada en la variable `prepender` devuelve todo lo que se le pasa pero anteponiendo el string: `'Mi nombre es:'` + +## 📝 Instrucciones: + +1. Usa el método `map` con la función `prepender` para crear un nuevo arreglo que se vea así: + +### Expected result: ```md [ 'My name is: Alice', @@ -16,5 +21,6 @@ Asigna el arreglo de nombres utilizando la función prepender para crear un nuev ``` -Pista: -Es una línea de código, ¡pasa la función map! \ No newline at end of file +### 💡 Pista: + +Es una línea de código, ¡pasa la función `map`! \ No newline at end of file diff --git a/exercises/20.3-Map-with-function-inside-variable/README.md b/exercises/20.3-Map-with-function-inside-variable/README.md index e8fd7bd5..11b0cd7f 100644 --- a/exercises/20.3-Map-with-function-inside-variable/README.md +++ b/exercises/20.3-Map-with-function-inside-variable/README.md @@ -2,11 +2,13 @@ The variable `names` contains a lot of names (dugh...) -The function stored in the variable `prepender` returns whatever -is passed to it but prepended with the string: 'My name is:' +The function stored in the variable `prepender` returns whatever is passed to it but prepended with the string: `'My name is:'` -# 📝Instructions -Please map the names array using the `prepender` function to create a new array that looks like this: +## 📝 Instructions: + +1. Please map the names array using the `prepender` function to create a new array that looks like this: + +### Resultado esperado: ```md [ 'My name is: Alice', @@ -19,5 +21,6 @@ Please map the names array using the `prepender` function to create a new array ``` -## 💡Hint: +### 💡 Hint: + It's one line of code, pass the function to the map! \ No newline at end of file diff --git a/exercises/20.4-Map-data-types/README.es.md b/exercises/20.4-Map-data-types/README.es.md index def9a25d..5a94d17d 100644 --- a/exercises/20.4-Map-data-types/README.es.md +++ b/exercises/20.4-Map-data-types/README.es.md @@ -1,13 +1,18 @@ +# `20.4` `Map` y tipos de datos + Algunas veces los arreglos vienen con valores mixtos y debes unificarlos en un solo tipo de datos. -Instrucciones -Actualiza la función map para que cree un nuevo arreglo que contenga los tipos de datos de cada elemento correspondiente al arreglo original. +## 📝 Instrucciones: + +1. Actualiza la función `map` para que cree un nuevo arreglo que contenga los tipos de datos de cada elemento correspondiente al arreglo original. + +### Resultado esperado: -El resultado en la consola debería ser algo como: ```md [string,string,... ,number,string,...] ``` -Pista: -Use la función typeof para obtener el tipo de datos -Más sobre el tipo de función \ No newline at end of file +### 💡 Pista: + +Usa la función `typeof` para obtener el tipo de datos +Más sobre el tipo de función. \ No newline at end of file diff --git a/exercises/20.4-Map-data-types/README.md b/exercises/20.4-Map-data-types/README.md index 672356ef..a30bc3cf 100644 --- a/exercises/20.4-Map-data-types/README.md +++ b/exercises/20.4-Map-data-types/README.md @@ -2,15 +2,17 @@ Some times arrays come with mixed values and you need to unify them into only one data type. -# 📝Instructions -- Update the map function to make it create a new array that contains the data types of - each corresponding item from the original array. +## 📝 Instructions: + +1. Update the `map` function to make it create a new array that contains the data types of each corresponding item from the original array. + +### Expected result: -The result in the console should be something like: ```md [string,string,... ,number,string,...] ``` -💡Hint: +### 💡 Hint: + Use the `typeof` function to get the data type -More about the typeof function \ No newline at end of file +More about the typeof function. \ No newline at end of file diff --git a/exercises/20.5-Map-arrays-of-objects/README.es.md b/exercises/20.5-Map-arrays-of-objects/README.es.md index 631f23e1..416e692a 100644 --- a/exercises/20.5-Map-arrays-of-objects/README.es.md +++ b/exercises/20.5-Map-arrays-of-objects/README.es.md @@ -1,20 +1,28 @@ +# `20.5` "Mapeando" un arreglo de objetos + El escenario más común para la función de mapeo es para simplificar los arreglos dados, por ejemplo: -El algoritmo actual crea un arreglo con solo los nombres de las personas y la imprime en la consola. +El algoritmo actual crea un arreglo con solo los nombres de las personas y los imprime en la consola. -Instrucciones +## 📝 Instrucciones: -Actualiza la función map para que cree un arreglo donde cada elemento contenga lo siguiente: +1. Actualiza la función `map` para que cree un arreglo donde cada elemento contenga lo siguiente: ```md Hello my name is Joe and I am 13 years old. ``` -Pista -Debes determinar la edad de cada persona según su fecha de nacimiento. Busca en Google "Cómo obtener la edad de la fecha de nacimiento dada en JavaScript" -Dentro de tu función simplifier, debe devolver una concatenación. +## 💡 Pista: + ++ Debes determinar la edad de cada persona según su fecha de nacimiento (birthDate).++ + ++ Busca en Google "Cómo obtener la edad de la fecha de nacimiento dada en JavaScript". + ++ Dentro de tu función simplifier, debe devolver una concatenación. + + +### Resultado esperado: -El resultado esperado debería ser similar pero no exactamente a esto: ```md [ 'Hello, my name is Joe and I am 32 years old', 'Hello, my name is Bob and I am 42 years old', diff --git a/exercises/20.5-Map-arrays-of-objects/README.md b/exercises/20.5-Map-arrays-of-objects/README.md index 5c198a95..26e88ec7 100644 --- a/exercises/20.5-Map-arrays-of-objects/README.md +++ b/exercises/20.5-Map-arrays-of-objects/README.md @@ -4,20 +4,24 @@ The most common scenario for the mapping function is for simplifying given array The current algorithm creates an array with only the names of the people and prints it on the console. -# 📝Instructions +## 📝 Instructions: -- Please update the mapping function so it creates an array where each item contains the following: +1. Please update the mapping function so it creates an array where each item contains the following: ```md Hello my name is Joe and I am 13 years old. ``` -## 💡Hint -You have to get the age of each people based on their birthDate. -Search in Google "How to get the age of given birth date in javascript" -Inside your simplifier function you have to return a concatenation. +## 💡 Hint: + ++ You have to get the age of each people based on their birthDate. + ++ Search in Google "How to get the age of given birth date in javascript". + ++ Inside your simplifier function you have to return a concatenation. + +### Expected result: -The expected output should look similar but not exactly to this: ```md [ 'Hello, my name is Joe and I am 32 years old', 'Hello, my name is Bob and I am 42 years old', @@ -26,4 +30,3 @@ The expected output should look similar but not exactly to this: 'Hello, my name is Steve and I am 14 years old' ] ``` - diff --git a/exercises/20.6-Yes-and-no/README.es.md b/exercises/20.6-Yes-and-no/README.es.md index 84e1d399..3fc06e8c 100644 --- a/exercises/20.6-Yes-and-no/README.es.md +++ b/exercises/20.6-Yes-and-no/README.es.md @@ -1,14 +1,23 @@ -Instrucciones -Por favor utiliza la funcionalidad del map para recorrer el arreglo de booleanos y cree un nuevo arreglo que contenga el string 'wiki' por cada 1 y 'woko' por cada 0 que tiene el arreglo original. -Imprime esa matriz en la consola. +# `20.6` Sí y no + +## 📝 Instrucciones: + +1. Por favor utiliza la funcionalidad del map para recorrer el arreglo de booleanos y crea un nuevo arreglo que contenga el string `wiki` por cada 1 y `woko` por cada 0 que tiene el arreglo original. + +2. Imprime ese arreglo en la consola. + +### Resultado esperado: -Ejemplo del output (salida): ```md [ 'woko', 'wiki', 'woko', 'woko', 'wiki', 'wiki', 'wiki', 'woko', 'woko', 'wiki', 'woko', 'wiki', 'wiki', 'woko', 'woko', 'woko', 'woko', 'woko', 'woko', 'woko', 'woko', 'wiki', 'woko', 'woko', 'woko', 'woko', 'wiki' ] ``` -Pista: -Necesitas mapear todo el arreglo -Dentro de tu función de mapeo, necesitas usar un condicional para verificar si el valor actual es 0 o 1. -Si el valor actual es 1, imprime el string 'wiki' -Si el valor actual es 0, imprime el string 'woko' +## 💡 Pista: + ++ Necesitas mapear todo el arreglo + ++ Dentro de tu función de mapeo, necesitas usar un condicional para verificar si el valor actual es 0 o 1. + ++ Si el valor actual es 1, imprime el string `wiki`. + ++ Si el valor actual es 0, imprime el string `woko` \ No newline at end of file diff --git a/exercises/20.6-Yes-and-no/README.md b/exercises/20.6-Yes-and-no/README.md index 297e6343..25c81bac 100644 --- a/exercises/20.6-Yes-and-no/README.md +++ b/exercises/20.6-Yes-and-no/README.md @@ -1,16 +1,23 @@ # `20.6` Yes and No -# 📝Instructions -- Please use the Array map functionality to loop the array of booleans and create a new array that contains the string 'wiki' for every 1 and 'woko' for every 0 that the original array had. -- Print that array on the console. +## 📝 Instructions: + +1. Please use the Array map functionality to loop the array of booleans and create a new array that contains the string `wiki` for every 1 and `woko` for every 0 that the original array had. + +2. Print that array on the console. + +### Expected result: -Example output: ```md [ 'woko', 'wiki', 'woko', 'woko', 'wiki', 'wiki', 'wiki', 'woko', 'woko', 'wiki', 'woko', 'wiki', 'wiki', 'woko', 'woko', 'woko', 'woko', 'woko', 'woko', 'woko', 'woko', 'wiki', 'woko', 'woko', 'woko', 'woko', 'wiki' ] ``` -## 💡Hint -You need to map the entire array -Inside your mapping function you need to use a conditional to verify if the current value is 0 or 1. -If the current value is 1 you print the string 'wiki' -If the current value is 0 you print the string 'woko' +## 💡 Hint: + ++ You need to map the entire array + ++ Inside your mapping function you need to use a conditional to verify if the current value is 0 or 1. + ++ If the current value is 1 you print the string `wiki`. + ++ If the current value is 0 you print the string `woko`.