diff --git a/exercises/01-Hello_World/README.es.md b/exercises/01-Hello_World/README.es.md index 78cb77b2..efd99938 100644 --- a/exercises/01-Hello_World/README.es.md +++ b/exercises/01-Hello_World/README.es.md @@ -1,10 +1,10 @@ # `01` Hello World -En JavaScript, usamos `console.log` para hacer que la computadora escriba lo que queramos (el contenido de una variable, una cadena dada, etc.) en algo llamado `la consola`. +En JavaScript, usamos `console.log()` para hacer que la computadora escriba lo que queramos (el contenido de una variable, una cadena de caracteres, etc.) en algo llamado **la consola**. Cada lenguaje de programación tiene una consola, ya que era la única forma de interactuar con los usuarios al principio (antes de que llegaran Windows o MacOS). -Hoy, la impresión en la consola se usa principalmente como una herramienta de monitoreo, ideal para dejar un rastro del contenido de las variables durante la ejecución del programa. +Hoy en día, imprimir en la consola se usa principalmente como una herramienta de monitoreo, ideal para dejar un rastro del contenido de las variables durante la ejecución del programa. Este es un ejemplo de cómo usarlo: @@ -14,7 +14,7 @@ console.log("How are you?"); ## 📝 Instrucciones: -1. Usa `console.log` para imprimir "Hello World" en la consola. Siéntete libre de probar otras cosas también. +1. Usa `console.log()` para imprimir "Hello World" en la consola. Siéntete libre de probar otras cosas también. ## 💡 Pista: diff --git a/exercises/01-Hello_World/README.md b/exercises/01-Hello_World/README.md index 8005a9c6..fbf2ee47 100644 --- a/exercises/01-Hello_World/README.md +++ b/exercises/01-Hello_World/README.md @@ -4,11 +4,11 @@ tutorial: https://www.youtube.com/watch?v=miBzmGgMIbU # `01` Hello World -In JavaScript, we use `console.log` to make the computer write anything we want (the content of a variable, a given string, etc.) in something called `the console`. +In JavaScript, we use `console.log()` to make the computer write anything we want (the content of a variable, a given string, etc.) in something called **the console**. -Every language has a console, as it was the only way to interact with the users at the beginning (before the Windows or MacOS arrived). +Every language has a console, as it was the only way to interact with the users at the beginning (before Windows or MacOS arrived). -Today, printing in the console is used mostly as a monitoring tool, ideal to leave a trace of the content of variables during the program execution. +Today, printing in the console is mostly used as a monitoring tool, ideal for leaving a trace of the content of variables during program execution. This is an example of how to use it: @@ -18,8 +18,8 @@ console.log("How are you?"); ## 📝 Instructions: -1. Use console.log to print "Hello World" on the console. Feel free to try other things as well. +1. Use `console.log()` to print "Hello World" on the console. Feel free to try other things as well. ## 💡 Hint: -+ 5 minutes video about the console: https://www.youtube.com/watch?v=1RlkftxAo-M ++ 5 minute video about the console: https://www.youtube.com/watch?v=1RlkftxAo-M diff --git a/exercises/01-Hello_World/tests.js b/exercises/01-Hello_World/tests.js index 07254e41..db9312f2 100644 --- a/exercises/01-Hello_World/tests.js +++ b/exercises/01-Hello_World/tests.js @@ -11,7 +11,7 @@ let _log = console.log; // We make the text lower case to make it case insensitive global.console.log = console.log = jest.fn((text) => _buffer += text.toLowerCase() + "\n"); -test('console.log() function should be called with Hello World', function () { +test('console.log() function should be called with "Hello World"', function () { /* Here is how to mock the alert function: diff --git a/exercises/02.1-Access_and_retrieve/README.es.md b/exercises/02.1-Access_and_retrieve/README.es.md index c8c4f102..bababe91 100644 --- a/exercises/02.1-Access_and_retrieve/README.es.md +++ b/exercises/02.1-Access_and_retrieve/README.es.md @@ -10,26 +10,26 @@ let myArray = ['sunday','monday','tuesday','wednesday','thursday','friday','satu Cada array tiene las siguientes partes: -- *Item*s*: son los valores reales dentro de cada posición del array (array). +- **Items** (Elementos): son los valores dentro de cada posición del array. -- *Length* (Longitud): es el tamaño del array, el número de elementos. +- **Length** (Longitud): es el tamaño del array, el número de elementos. -- *Index* (indice): es la posición de un elemento. +- **Index** (Índice): es la posición de un elemento. ![Como funciona un array](../../.learn/assets/DbmSOHT.png?raw=true) -Para acceder a cualquier elemento en particular dentro de un array (array) debes conocer su índice (posición). El índice o index es un valor entero que representa la posición en la que se encuentra el elemento. +Para acceder a cualquier elemento en particular dentro de un array debes conocer su índice (posición). El índice o index es un valor entero que representa la posición en la que se encuentra el elemento. -**!IMPORTANTE: ¡Cada array comienza desde cero (0)!** +**IMPORTANTE: ¡Cada array comienza desde cero (0)!** -## 📝 Instrucciones +## 📝 Instrucciones: -1. Usando la función `console.log`, imprime el tercer elemento del array. +1. Usando la función `console.log()`, imprime el tercer elemento del array. -2. Cambia el valor en la posición donde se encuentra `jueves` a `null` (nulo). +2. Cambia el valor en la posición donde se encuentra `thursday` a `null`. -3. Imprime esa posición en particular. +3. Imprime esa posición. ## 💡 Pista: - + Usa `null` como valor y no como un string. ++ Usa `null` como valor y no como un string. diff --git a/exercises/02.1-Access_and_retrieve/README.md b/exercises/02.1-Access_and_retrieve/README.md index 5453093a..4c242063 100644 --- a/exercises/02.1-Access_and_retrieve/README.md +++ b/exercises/02.1-Access_and_retrieve/README.md @@ -4,20 +4,21 @@ tutorial: https://www.youtube.com/watch?v=9-yAzjsWXtU # `02.1` Access and Retrieve -Arrays are part of every programming language. They are the way to go when you want to have a "list of elements." +Arrays are part of every programming language. They are the way to go when you want to have a "list of elements". For example, we could have an array that stores the days of the week: ```js let myArray = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; ``` + Every array has the following parts: -- *Items*: are the actual values inside on each position of the array. +- **Items**: are the actual values inside each position of the array. -- *Length*: is the size of the array, the number of items. +- **Length**: is the size of the array, the number of items. -- *Index*: is the position of an element. +- **Index**: is the position of an element (item). ![How arrays work](../../.learn/assets/DbmSOHT.png?raw=true) @@ -25,9 +26,9 @@ To access any item within the array you need to know its index (position). The i **IMPORTANT: Every array starts from zero (0)!** -## 📝 Instructions +## 📝 Instructions: -1. Using the `console.log` function, print the 3rd item from the array. +1. Using the `console.log()` function, print the 3rd item from the array. 2. Change the value in the position where `thursday` is located to `null`. diff --git a/exercises/02.1-Access_and_retrieve/app.js b/exercises/02.1-Access_and_retrieve/app.js index eec85929..70c752f1 100644 --- a/exercises/02.1-Access_and_retrieve/app.js +++ b/exercises/02.1-Access_and_retrieve/app.js @@ -1,8 +1,8 @@ -//declaring the array +// Declaring the array let myArray = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; -//1. print the item here +// 1. print the 3rd item here -//2. change 'thursday'a value here to null +// 2. change the 'thursday' value to null here -//3. print the position of step 2 \ No newline at end of file +// 3. print the position of step 2 diff --git a/exercises/02.1-Access_and_retrieve/solution.hide.js b/exercises/02.1-Access_and_retrieve/solution.hide.js index 84ad1a16..064e0e51 100644 --- a/exercises/02.1-Access_and_retrieve/solution.hide.js +++ b/exercises/02.1-Access_and_retrieve/solution.hide.js @@ -1,14 +1,14 @@ -//declaring the array +// Declaring the array -//. 0. 1. 2. 3. 4. 5. 6 +//. positions: 0 1 2 3 4 5 6 let myArray = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; -//1. print the item here -console.log(myArray[2]) +// 1. print the 3rd item here +console.log(myArray[2]); -//2. change 'thursday'a value here to null +// 2. change 'thursday' value to null here myArray[4] = null; -//3. print the position of step 2 -console.log(myArray[4]) \ No newline at end of file +// 3. print the position of step 2 +console.log(myArray[4]); diff --git a/exercises/02.1-Access_and_retrieve/tests.js b/exercises/02.1-Access_and_retrieve/tests.js index 06805d52..3e59ad95 100644 --- a/exercises/02.1-Access_and_retrieve/tests.js +++ b/exercises/02.1-Access_and_retrieve/tests.js @@ -20,7 +20,7 @@ it('console.log() function should have been called 2 times', function () { expect(console.log.mock.calls.length).toBe(2); }); -it('Print the third item on the array (position 2)', function () { +it('Print the 3rd item of the array (position 2)', function () { //You can also compare the entire console buffer (if there have been several console.log calls on the exercise) expect(_buffer.includes("tuesday\n")).toBe(true); }); @@ -29,7 +29,7 @@ it('The fourth item in the array must be equal to "null"' , function(){ expect(myArray[4]).toBe(null) }) -it('Print the 4th position of the array', function () { +it('Print the 4th position of the array (item 5)', function () { //You can also compare the entire console buffer (if there have been several console.log calls on the exercise) expect(_buffer.includes("null\n")).toBe(true); -}); \ No newline at end of file +}); diff --git a/exercises/02.2-Retrieve_Items/README.es.md b/exercises/02.2-Retrieve_Items/README.es.md index d5980863..8a1eca4b 100644 --- a/exercises/02.2-Retrieve_Items/README.es.md +++ b/exercises/02.2-Retrieve_Items/README.es.md @@ -1,6 +1,6 @@ # `02.2` Retrieve Items -La única forma de acceder a un elemento particular en un arreglo es usando un índice. Un **índice (index)** es un número entero que representa la posición a la que desea acceder en el arreglo. +La única forma de acceder a un elemento particular en un arreglo es usando el índice. El **índice (index)** es un número entero que representa la posición a la que desea acceder en el arreglo. Debes envolver el índice entre corchetes de esta manera: @@ -8,8 +8,8 @@ Debes envolver el índice entre corchetes de esta manera: let myValue = array[index]; ``` -## 📝 Instrucciones +## 📝 Instrucciones: -1. Imprima en la consola el 1er elemento de array o arreglo. +1. Imprima en la consola el 1er elemento del array. -2. Imprima en la consola el 4to elemento de la arreglo o array. \ No newline at end of file +2. Imprima en la consola el 4to elemento del array. diff --git a/exercises/02.2-Retrieve_Items/README.md b/exercises/02.2-Retrieve_Items/README.md index d92c3ebd..31f733a2 100644 --- a/exercises/02.2-Retrieve_Items/README.md +++ b/exercises/02.2-Retrieve_Items/README.md @@ -4,7 +4,7 @@ tutorial: https://www.youtube.com/watch?v=rWYIgofIAME # `02.2` Retrieve Items -The only way to access a particular element in an array is by using an index. An **index** is an integer number that represents the position you want to access in the array. +The only way to access a particular element in an array is by using the index. The **index** is an integer number that represents the position you want to access in the array. You need to wrap the index into brackets like this: @@ -14,6 +14,6 @@ let myValue = array[index]; ## 📝 Instructions: -1. Print on the console the 1st element of the array +1. Print on the console the 1st element of the array. -2. Print on the console the 4th element of the array +2. Print on the console the 4th element of the array. diff --git a/exercises/02.2-Retrieve_Items/app.js b/exercises/02.2-Retrieve_Items/app.js index de6a1d49..00055b71 100644 --- a/exercises/02.2-Retrieve_Items/app.js +++ b/exercises/02.2-Retrieve_Items/app.js @@ -1,3 +1,3 @@ let arr = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]; -//your code here \ No newline at end of file +// your code here diff --git a/exercises/02.2-Retrieve_Items/solution.hide.js b/exercises/02.2-Retrieve_Items/solution.hide.js index 01e6a002..d87f9889 100644 --- a/exercises/02.2-Retrieve_Items/solution.hide.js +++ b/exercises/02.2-Retrieve_Items/solution.hide.js @@ -1,11 +1,8 @@ -// 0.1. 2. 3. 4. 5. 6.7. 8. 9. 10..... +// 0.1. 2. 3. 4. 5. 6. 7. 8. 9. 10..... let arr = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]; -//your code here - -let aux = arr[0]; +// your code here console.log(arr[0]); - -console.log(arr[3]); \ No newline at end of file +console.log(arr[3]); diff --git a/exercises/02.2-Retrieve_Items/tests.js b/exercises/02.2-Retrieve_Items/tests.js index a41ab3b8..9a63ebe7 100644 --- a/exercises/02.2-Retrieve_Items/tests.js +++ b/exercises/02.2-Retrieve_Items/tests.js @@ -17,7 +17,7 @@ it('console.log() function should have been called 2 times', function () { expect(console.log.mock.calls.length).toBe(2); }); -it('Print the 1st item on the array (position 2)', function () { +it('Print the 1st item of the array (position 0)', function () { //You can also compare the entire console buffer (if there have been several console.log calls on the exercise) expect(_buffer.includes("4\n")).toBe(true); }); @@ -25,4 +25,4 @@ it('Print the 1st item on the array (position 2)', function () { it('Print the 4th item of the array', function () { //You can also compare the entire console buffer (if there have been several console.log calls on the exercise) expect(_buffer.includes("43\n")).toBe(true); -}); \ No newline at end of file +}); diff --git a/exercises/03-Print_the_last_one/README.es.md b/exercises/03-Print_the_last_one/README.es.md index 466942f0..23749d72 100644 --- a/exercises/03-Print_the_last_one/README.es.md +++ b/exercises/03-Print_the_last_one/README.es.md @@ -2,7 +2,7 @@ Nunca sabrás cuántos elementos tiene `myStupidArray` porque se genera aleatoriamente durante el tiempo de ejecución utilizando la función `generateRandomArray`. -¡Pero no te preocupes! La propiedad `myStupidArray.length` devuelve la longitud de `myArray` (intenta hacer un `console.log` y verás la longitud que se muestra en la consola). +¡Pero no te preocupes! La propiedad `myStupidArray.length` devuelve la longitud de `myStupidArray` (intenta hacer un `console.log()` y verás la longitud que se muestra en la consola). ```js let totalItems = myStupidArray.length; @@ -12,4 +12,4 @@ let totalItems = myStupidArray.length; 1. Crea una variable llamada `theLastOne` y asígnale el último elemento de `myStupidArray`. -2. Luego, imprímelo en la consola. \ No newline at end of file +2. Luego, imprímelo en la consola. diff --git a/exercises/03-Print_the_last_one/README.md b/exercises/03-Print_the_last_one/README.md index d3cc20e5..9994eaa5 100644 --- a/exercises/03-Print_the_last_one/README.md +++ b/exercises/03-Print_the_last_one/README.md @@ -6,14 +6,14 @@ tutorial: https://www.youtube.com/watch?v=d-CnlwX6x1A You will never know how many items `myStupidArray` has because it is being randomly generated during runtime using the `generateRandomArray` function. -But don't worry! The property `myStupidArray.length` returns the length of `myArray` (try console logging it and you will see the length displayed on the console). +But don't worry! The property `myStupidArray.length` returns the length of `myStupidArray` (try console logging it, and you will see the length displayed on the console). ```js let totalItems = myStupidArray.length; ``` -## 📝 Instructions +## 📝 Instructions: -1. Create a variable named `theLastOne`, and assign it the LAST element of `myStupidArray`. +1. Create a variable named `theLastOne`, and assign to it the LAST element of `myStupidArray`. 2. Then, print it on the console. diff --git a/exercises/03-Print_the_last_one/app.js b/exercises/03-Print_the_last_one/app.js index cc912fbf..e4dc515a 100644 --- a/exercises/03-Print_the_last_one/app.js +++ b/exercises/03-Print_the_last_one/app.js @@ -7,4 +7,4 @@ function generateRandomArray() } let myStupidArray = generateRandomArray(); -//Your code here +// Your code here diff --git a/exercises/03-Print_the_last_one/solution.hide.js b/exercises/03-Print_the_last_one/solution.hide.js index f2aa799c..8ffa4d85 100644 --- a/exercises/03-Print_the_last_one/solution.hide.js +++ b/exercises/03-Print_the_last_one/solution.hide.js @@ -2,12 +2,12 @@ function generateRandomArray() { let auxArray = []; let randomLength = Math.floor(Math.random()*100); - for(let i = 0;i { -// console.log(parseInt(index)+1) -// }) - -// MY SOLUTION.HIDE.JS - -//change the conditions of the for loop -for(let number = 1; number <= 17; number++){ - //print the number +// Change the conditions of the for loop +for(let number = 1; number <= 17; number++) { + // Print the number console.log(number) } diff --git a/exercises/04.1-Loop_from_one_to_seventeen/tests.js b/exercises/04.1-Loop_from_one_to_seventeen/tests.js index 17aea42e..0f1e6587 100644 --- a/exercises/04.1-Loop_from_one_to_seventeen/tests.js +++ b/exercises/04.1-Loop_from_one_to_seventeen/tests.js @@ -6,16 +6,16 @@ let _log = console.log; let _buffer = ''; global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); -it('Call the console.log function on every cicle', function () { +it('Call the console.log function on every cycle', function () { const app = require('./app.js'); expect(console.log.mock.calls.length).toBe(17); }); -test('You have to use a for loop', () => { +test('You have to use a "for" loop', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /for\s*/gm expect(regex.test(file.toString())).toBeTruthy(); }) -it('Print the numbers on the console on each loop cicle (inside the loop)', function () { +it('Print the numbers on the console on each loop cycle (inside the loop)', function () { expect(_buffer).toMatch("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n"); -}); \ No newline at end of file +}); diff --git a/exercises/04.2-Loop_from_seven_to_twelve/README.es.md b/exercises/04.2-Loop_from_seven_to_twelve/README.es.md index 7892d7d8..80ada9c7 100644 --- a/exercises/04.2-Loop_from_seven_to_twelve/README.es.md +++ b/exercises/04.2-Loop_from_seven_to_twelve/README.es.md @@ -4,7 +4,7 @@ 1. Cuenta del 7 al 12 con un loop e imprime cada número en la consola. -## Ejemplo de salida: +## 💻 Ejemplo de salida: ```js 7 @@ -17,4 +17,4 @@ ## 💡 Pista: -+ Tienes que recorrer de 7 a 12 (incluyendo 12). \ No newline at end of file ++ Tienes que recorrer del 7 a 12 (incluyendo 12). diff --git a/exercises/04.2-Loop_from_seven_to_twelve/README.md b/exercises/04.2-Loop_from_seven_to_twelve/README.md index de575b13..824ae907 100644 --- a/exercises/04.2-Loop_from_seven_to_twelve/README.md +++ b/exercises/04.2-Loop_from_seven_to_twelve/README.md @@ -8,7 +8,7 @@ tutorial: https://www.youtube.com/watch?v=6eLXV_IL2m0 1. Count from 7 to 12 with a loop and print each number on the console. -## Example output: +## 💻 Example output: ```js 7 @@ -21,5 +21,5 @@ tutorial: https://www.youtube.com/watch?v=6eLXV_IL2m0 ## 💡 Hint: -You have to loop from 7 to 12 (including 12). ++ You have to loop from 7 to 12 (including 12). diff --git a/exercises/04.2-Loop_from_seven_to_twelve/app.js b/exercises/04.2-Loop_from_seven_to_twelve/app.js index 8772f7b9..877a3aa0 100644 --- a/exercises/04.2-Loop_from_seven_to_twelve/app.js +++ b/exercises/04.2-Loop_from_seven_to_twelve/app.js @@ -1 +1 @@ -//you code here \ No newline at end of file +// Your code here diff --git a/exercises/04.2-Loop_from_seven_to_twelve/solution.hide.js b/exercises/04.2-Loop_from_seven_to_twelve/solution.hide.js index 60f70f03..0ea14ad6 100644 --- a/exercises/04.2-Loop_from_seven_to_twelve/solution.hide.js +++ b/exercises/04.2-Loop_from_seven_to_twelve/solution.hide.js @@ -1,4 +1,4 @@ -//you code here -for(let i = 7; i <= 12; i++){ +// Your code here +for(let i = 7; i <= 12; i++) { console.log(i) -} \ No newline at end of file +} diff --git a/exercises/04.2-Loop_from_seven_to_twelve/tests.js b/exercises/04.2-Loop_from_seven_to_twelve/tests.js index 90ced602..cc3b44fa 100644 --- a/exercises/04.2-Loop_from_seven_to_twelve/tests.js +++ b/exercises/04.2-Loop_from_seven_to_twelve/tests.js @@ -6,17 +6,17 @@ let _log = console.log; let _buffer = ''; global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); -it('Call the console.log function just one time', function () { +it('Call the console.log function on every cycle', function () { const app = require('./app.js'); expect(console.log.mock.calls.length).toBe(6); }); -test('You have to use a for loop', () => { +test('You have to use a "for" loop', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /for\s*/gm expect(regex.test(file.toString())).toBeTruthy(); }) -it('Print the numbers on the console on each loop cicly (inside the loop)', function () { +it('Print the numbers on the console on each loop cycle (inside the loop)', function () { expect(_buffer).toMatch("7\n8\n9\n10\n11\n12\n"); -}); \ No newline at end of file +}); diff --git a/exercises/04.3-Add_items_to_array/README.es.md b/exercises/04.3-Add_items_to_array/README.es.md index 7d878cfb..39467fb6 100644 --- a/exercises/04.3-Add_items_to_array/README.es.md +++ b/exercises/04.3-Add_items_to_array/README.es.md @@ -8,4 +8,4 @@ + Puedes usar las funciones `Math.random()` y `Math.floor()` para obtener números aleatorios. -+ Debes usar la función `.push (item)` para agregar el nuevo número aleatorio al array \ No newline at end of file ++ Debes usar la función `.push()` para agregar los números aleatorios al array. diff --git a/exercises/04.3-Add_items_to_array/README.md b/exercises/04.3-Add_items_to_array/README.md index bf833e8e..44576d59 100644 --- a/exercises/04.3-Add_items_to_array/README.md +++ b/exercises/04.3-Add_items_to_array/README.md @@ -12,4 +12,4 @@ tutorial: https://www.youtube.com/watch?v=no9mCu-tvaM + You can use the `Math.random()` and `Math.floor()` functions to get random numbers. -+ You have to use the `.push(item)` function to add the new random number to the array. ++ You have to use the `.push()` function to add the new random numbers to the array. diff --git a/exercises/04.3-Add_items_to_array/app.js b/exercises/04.3-Add_items_to_array/app.js index 69a54ece..5e894127 100644 --- a/exercises/04.3-Add_items_to_array/app.js +++ b/exercises/04.3-Add_items_to_array/app.js @@ -1,5 +1,5 @@ let arr = [4,5,734,43,45]; -// Your code here, use the push function and the random function. +// Your code here, use the push() function and the 2 Math functions -console.log(arr); \ No newline at end of file +console.log(arr); diff --git a/exercises/04.3-Add_items_to_array/tests.js b/exercises/04.3-Add_items_to_array/tests.js index 32d88747..00ead37a 100644 --- a/exercises/04.3-Add_items_to_array/tests.js +++ b/exercises/04.3-Add_items_to_array/tests.js @@ -9,18 +9,18 @@ global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); const file = rewire("./app.js"); const arr = file.__get__("arr"); -it('Call the console.log function just one time', function () { +it('Call the console.log function only one time', function () { const app = require('./app.js'); expect(console.log.mock.calls.length).toBe(1); }); -it('Use the Math.floor function for whole numbers.(NO DECIMALS)', () => { +it('Use the Math.floor function for whole numbers (NO DECIMALS)', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /Math\s*\.\s*floor/gm expect(regex.test(file.toString())).toBeTruthy(); }) -it('The array arr should have 7 items', function () { +it('The array "arr" should have 7 items', function () { const app = rewire('./app.js'); const variable = app.__get__('arr'); expect(variable).toBeTruthy(); @@ -38,4 +38,4 @@ it('Make sure the last two items you added are numbers', function () { const variable = app.__get__('arr'); expect(isNumeric(variable[6])).toBeTruthy(); expect(isNumeric(variable[5])).toBeTruthy(); -}); \ No newline at end of file +}); diff --git a/exercises/04.4-Add_items_to_array_looping/README.es.md b/exercises/04.4-Add_items_to_array_looping/README.es.md index 0d786e24..b01367d7 100644 --- a/exercises/04.4-Add_items_to_array_looping/README.es.md +++ b/exercises/04.4-Add_items_to_array_looping/README.es.md @@ -2,7 +2,7 @@ ## 📝 Instrucciones: -1. Agrega 10 números enteros aleatorios a la lista `arr` e imprime el array o arreglo en la consola. +1. Agrega 10 números enteros aleatorios a la lista `arr` e imprime el array en la consola. ## 💡 Pistas: @@ -12,4 +12,4 @@ + Puedes usar las funciones `Math.random()` y `Math.floor()` para obtener números aleatorios, debes hacerlo dentro del loop. -+ En cada iteración del loop, debes usar la función `.push (item)` para agregar el nuevo número aleatorio al array. ++ En cada iteración del loop debes usar la función `.push()` para agregar el nuevo número aleatorio al array. diff --git a/exercises/04.4-Add_items_to_array_looping/README.md b/exercises/04.4-Add_items_to_array_looping/README.md index 081cbfe9..5fc203e9 100644 --- a/exercises/04.4-Add_items_to_array_looping/README.md +++ b/exercises/04.4-Add_items_to_array_looping/README.md @@ -16,4 +16,4 @@ tutorial: https://www.youtube.com/watch?v=QLnkSPNTgNo + You can use the `Math.random()` and `Math.floor()` functions to get random numbers, you should do that inside the loop. -+ On each loop iteration you have to use the `.push(item)` function to add the new random number to the array. ++ On each loop iteration you have to use the `.push()` function to add the new random number to the array. diff --git a/exercises/04.4-Add_items_to_array_looping/solution.hide.js b/exercises/04.4-Add_items_to_array_looping/solution.hide.js index dd433b01..38b7d1e2 100644 --- a/exercises/04.4-Add_items_to_array_looping/solution.hide.js +++ b/exercises/04.4-Add_items_to_array_looping/solution.hide.js @@ -3,12 +3,10 @@ let arr = [4,5,734,43,45]; //***************** // Your code here // you need to loop 10 times, for example, using a for loop -// for(let i = 0; i<10;i++){ -// your loop content here -// } //***************** -for(let i = 0; i<10; i++){ +for(let i = 0; i < 10; i++) { arr.push(Math.floor(Math.random() * 100)); } + console.log(arr); diff --git a/exercises/04.4-Add_items_to_array_looping/tests.js b/exercises/04.4-Add_items_to_array_looping/tests.js index a8cd7037..e7433abd 100644 --- a/exercises/04.4-Add_items_to_array_looping/tests.js +++ b/exercises/04.4-Add_items_to_array_looping/tests.js @@ -6,15 +6,11 @@ let _log = console.log; let _buffer = ''; global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); -it('Call the console.log function just one time', function () { +it('Call the console.log function only one time', function () { const app = require('./app.js'); expect(console.log.mock.calls.length).toBe(1); }); -it('Print the array with 15 digits on the console', function () { - expect(_buffer).toMatch(/\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+/); -}); - it('You have to use Math.random() function', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /Math\s*\.\s*random/gm @@ -27,9 +23,9 @@ it('You have to use Math.floor() function', () => { expect(regex.test(file.toString())).toBeTruthy(); }) -test('The array arr should have 15 items', function () { +test('The array "arr" should have 15 items', function () { const app = rewire('./app.js'); const variable = app.__get__('arr'); expect(variable).toBeTruthy(); expect(variable.length).toBe(15); -}); \ No newline at end of file +}); diff --git a/exercises/05.1-Loop_Array/README.es.md b/exercises/05.1-Loop_Array/README.es.md index 3aee2d60..fe569c91 100644 --- a/exercises/05.1-Loop_Array/README.es.md +++ b/exercises/05.1-Loop_Array/README.es.md @@ -1,15 +1,15 @@ # `05.1` Loop an array -Ok, esta es la primera vez que vas a recorrer un loop o bucle desde cero, tómate 6 minutos para ver este video sobre [cómo recorrer un arreglo](https://www.youtube.com/watch?v=24Wpg6njlYI). +Ok, esta es la primera vez que vas a recorrer un array desde cero. ## 📝 Instrucciones: -El código ahora imprime el primer elemento en la consola. +Ahora mismo el código imprime el primer elemento en la consola. -1. En vez de ello, imprime todos los elementos en el arreglo o array. Tendrás que recorrer todo el arreglo utilizando un loop. +1. En vez de ello, imprime todos los elementos del arreglo o array. Tendrás que recorrer todo el array utilizando un loop. ## 💡 Pistas: -+ Recuerda que para acceder al valor de una posición debe usar el índice `(myArray [index])`. ++ Recuerda que para acceder al valor de una posición debe usar el índice o index `myArray[index]`. -+ [Aquí tienes un video genial](https://www.youtube.com/watch?v=24Wpg6njlYI) que explica cómo usar el bucle `for` para recorrer el loop de un arreglo o array. \ No newline at end of file ++ [Aquí tienes un video genial](https://www.youtube.com/watch?v=24Wpg6njlYI) que explica cómo usar el bucle *for* para recorrer un array. diff --git a/exercises/05.1-Loop_Array/README.md b/exercises/05.1-Loop_Array/README.md index af1a65e1..161f511f 100644 --- a/exercises/05.1-Loop_Array/README.md +++ b/exercises/05.1-Loop_Array/README.md @@ -4,18 +4,16 @@ tutorial: https://www.youtube.com/watch?v=Dd2uXOwhTzY # `05.1` Loop an array -In this exercise you will be looping an array from scratch. If you need a refresher, please take 6 minutes to watch this video on [how to loop an array](https://www.youtube.com/watch?v=24Wpg6njlYI). +In this exercise, you will be looping an array from scratch. ## 📝 Instructions: The code right now is printing the first item in the console. -Instead of doing that: - -1. Print all the elements in the array. Iterate through the whole array using a loop. +1. Instead of doing that, print all the elements in the array. Iterate through the whole array using a loop. ## 💡 Hints: -+ Remember that to access the value of a position you have to use the index `(myArray[index])`. ++ Remember that to access the value of a position, you have to use the index `myArray[index]`. -+ [Here is a cool video](https://www.youtube.com/watch?v=24Wpg6njlYI) explaining how to use the `for` loop to loop arrays. ++ [Here is a cool video](https://www.youtube.com/watch?v=24Wpg6njlYI) explaining how to use the *for loop* to loop arrays. diff --git a/exercises/05.1-Loop_Array/app.js b/exercises/05.1-Loop_Array/app.js index 04f18c52..f5f8921f 100644 --- a/exercises/05.1-Loop_Array/app.js +++ b/exercises/05.1-Loop_Array/app.js @@ -1,4 +1,4 @@ let myArray = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,3,5,5365743,52,34,3,55,33,435,4,6,54,63,45,4,67,56,47,1,34,54,32,54,1,78,98,0,9,8,98,76,7,54,2,3,42,456,4,3321,5]; -// wrap this console.log withing a loop and replace 0 with i -console.log(myArray[0]); \ No newline at end of file +// Wrap this console.log withing a loop and replace 0 with i +console.log(myArray[0]); diff --git a/exercises/05.1-Loop_Array/solution.hide.js b/exercises/05.1-Loop_Array/solution.hide.js index 5a3d01f5..4f297821 100644 --- a/exercises/05.1-Loop_Array/solution.hide.js +++ b/exercises/05.1-Loop_Array/solution.hide.js @@ -1,8 +1,6 @@ - -// 0. 1. 2.3 4 5 6 7 let myArray = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,3,5,5365743,52,34,3,55,33,435,4,6,54,63,45,4,67,56,47,1,34,54,32,54,1,78,98,0,9,8,98,76,7,54,2,3,42,456,4,3321,5]; -// wrap this console.log withing a loop and replace 0 with i -for(let i = 0; i < myArray.length; i++){ +// Wrap this console.log withing a loop and replace 0 with i +for(let i = 0; i < myArray.length; i++) { console.log(myArray[i]); -} \ No newline at end of file +} diff --git a/exercises/05.1-Loop_Array/tests.js b/exercises/05.1-Loop_Array/tests.js index ae9df2d6..12287403 100644 --- a/exercises/05.1-Loop_Array/tests.js +++ b/exercises/05.1-Loop_Array/tests.js @@ -7,7 +7,7 @@ let _buffer = ''; global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); -test('You have to use a for loop', () => { +test('You have to use a "for" loop', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /for\s*/gm expect(regex.test(file.toString())).toBeTruthy(); @@ -24,4 +24,4 @@ it('Print every item on the console', function () { const app = rewire('./app.js'); const variable = app.__get__('myArray'); expect(_buffer).toMatch(variable.map(n => n+"\n").join("")); -}); \ No newline at end of file +}); diff --git a/exercises/06.2-Loop-from-the-top/README.md b/exercises/06.2-Loop-from-the-top/README.md index 30c10308..c443bd4b 100644 --- a/exercises/06.2-Loop-from-the-top/README.md +++ b/exercises/06.2-Loop-from-the-top/README.md @@ -4,18 +4,18 @@ tutorial: https://www.youtube.com/watch?v=IX2m3SWq7tg # `06.2` Loop from the top -This loop is looping the array from beginning to end... increasing one by one. +This loop is looping the array from beginning to end, increasing one by one. ## 📝 Instructions: 1. Try looping from the end to the beginning. -## Expected result: +## 💻 Expected result: ![image](../../.learn/assets/06.2.png) -## 💡 Hint: +## 💡 Hints: -+ Remember the loop works like [this](https://www.youtube.com/watch?v=TSMzvFwpE_A) ++ Remember that [loops work like this](https://www.youtube.com/watch?v=TSMzvFwpE_A). -+ The last position of the array will be `mySampleArray.length - 1` because arrays start at 0 \ No newline at end of file ++ The last position of the array will be `mySampleArray.length - 1` because arrays start at 0. diff --git a/exercises/06.2-Loop-from-the-top/app.js b/exercises/06.2-Loop-from-the-top/app.js index 79b11d5c..0d4498bb 100644 --- a/exercises/06.2-Loop-from-the-top/app.js +++ b/exercises/06.2-Loop-from-the-top/app.js @@ -1,7 +1,7 @@ let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; -for(let i = 0; i= 0', function () { +it('Print the array from last to first item, starting at mySampleArray.length-1 and ending at >= 0', function () { const app = rewire('./app.js'); const variable = app.__get__('mySampleArray'); expect(_buffer).toMatch(variable.reverse().map(n => n+"\n").join("")); -}); \ No newline at end of file +}); diff --git a/exercises/06.3-Loop-adding-two/README.es.md b/exercises/06.3-Loop-adding-two/README.es.md index b44bdcac..85435458 100644 --- a/exercises/06.3-Loop-adding-two/README.es.md +++ b/exercises/06.3-Loop-adding-two/README.es.md @@ -1,12 +1,12 @@ -# `06.3` Loop de dos en dos +# `06.3` Loop every two positions -Este código está reproduciendo todo el conjunto, uno por uno, e imprime los elementos en la consola. +Este código está recorriendo todo el array uno por uno, imprimiendo cada elemento en la consola. ## 📝 Instrucciones: -1. Cambia el bucle para que se repita de dos en dos en lugar de uno por uno. +1. Cambia el bucle para que recorra de dos en dos en lugar de uno por uno. -## Resultado esperado: +## 💻 Resultado esperado: ```js 3423 @@ -16,4 +16,4 @@ Este código está reproduciendo todo el conjunto, uno por uno, e imprime los el 48 55 25 -``` \ No newline at end of file +``` diff --git a/exercises/06.3-Loop-adding-two/README.md b/exercises/06.3-Loop-adding-two/README.md index 9c411b59..39f9f539 100644 --- a/exercises/06.3-Loop-adding-two/README.md +++ b/exercises/06.3-Loop-adding-two/README.md @@ -2,15 +2,15 @@ tutorial: https://www.youtube.com/watch?v=VpXGQbY6UFs --- -# `06.3` Loop adding two +# `06.3` Loop every two positions This code is looping the whole array, one by one, and printing the items on the console. ## 📝 Instructions: -1. Change the loop so it loops two by two instead of one by one. +1. Change the loop, so it loops two by two instead of one by one. -## Expected result: +## 💻 Expected result: ```js 3423 @@ -20,4 +20,4 @@ This code is looping the whole array, one by one, and printing the items on the 48 55 25 -``` \ No newline at end of file +``` diff --git a/exercises/06.3-Loop-adding-two/app.js b/exercises/06.3-Loop-adding-two/app.js index 79b11d5c..0d4498bb 100644 --- a/exercises/06.3-Loop-adding-two/app.js +++ b/exercises/06.3-Loop-adding-two/app.js @@ -1,7 +1,7 @@ let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; -for(let i = 0; i { +test('You have to use a "for" loop', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /for\s*/gm expect(regex.test(file.toString())).toBeTruthy(); @@ -23,4 +23,4 @@ it('Loop the array but jumping two items at a time instead of just one at a time const app = rewire('./app.js'); const variable = app.__get__('mySampleArray'); expect(_buffer).toMatch(variable.filter((n,i) => i % 2 == 0).map(n => n+"\n").join("")); -}); \ No newline at end of file +}); diff --git a/exercises/06.4-Loop-from-the-half-to-the-end/README.es.md b/exercises/06.4-Loop-from-the-half-to-the-end/README.es.md index af2ca91e..85168da7 100644 --- a/exercises/06.4-Loop-from-the-half-to-the-end/README.es.md +++ b/exercises/06.4-Loop-from-the-half-to-the-end/README.es.md @@ -1,16 +1,16 @@ -# `06.4` Loop desde la mitad hasta el final +# `06.4` Loop from half to the end -Este bucle (loop) no está recorriendo el arreglo porque las variables `initialValue`, `stopValue` y `increasingValue` son iguales a cero. +Este bucle (loop) no está recorriendo el arreglo porque las variables `initialValue`, `stopValue` y `increasingValue` son iguales a cero `0`. ## 📝 Instrucciones: 1. Cambia el valor de esas variables para que el bucle imprima solo la última mitad del arreglo. -### :bulb: Pista: +## 💡 Pista: -¡Solo cambia el valor de esas 3 variables! ++ ¡Solo cambia el valor de esas 3 variables! -### Resultado esperado: +## 💻 Resultado esperado: ```js 23 @@ -20,4 +20,4 @@ Este bucle (loop) no está recorriendo el arreglo porque las variables `initialV 23 25 12 -``` \ No newline at end of file +``` diff --git a/exercises/06.4-Loop-from-the-half-to-the-end/README.md b/exercises/06.4-Loop-from-the-half-to-the-end/README.md index 811bfcdf..522d7957 100644 --- a/exercises/06.4-Loop-from-the-half-to-the-end/README.md +++ b/exercises/06.4-Loop-from-the-half-to-the-end/README.md @@ -2,19 +2,19 @@ tutorial: https://www.youtube.com/watch?v=rZp3TrD8tto --- -# `06.4` Loop from the half to the end +# `06.4` Loop from half to the end -This loop is not looping at all... because the variables `initialValue`, `stopValue` and `increasingValue` are equal to zero. +This loop is not looping at all... because the variables `initialValue`, `stopValue` and `increasingValue` are equal to zero `0`. ## 📝 Instructions: 1. Change the value of those variables to make the loop print only the last half of the array. -### :bulb: Hint: +## 💡 Hint: + Change nothing but the value of those 3 variables! -### Expected result: +## 💻 Expected result: ```js 23 @@ -24,4 +24,4 @@ This loop is not looping at all... because the variables `initialValue`, `stopVa 23 25 12 -``` \ No newline at end of file +``` diff --git a/exercises/06.4-Loop-from-the-half-to-the-end/app.js b/exercises/06.4-Loop-from-the-half-to-the-end/app.js index 3e1a93cb..697e1894 100644 --- a/exercises/06.4-Loop-from-the-half-to-the-end/app.js +++ b/exercises/06.4-Loop-from-the-half-to-the-end/app.js @@ -2,9 +2,9 @@ let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; let initialValue = 0; let stopValue = 0; -let increasingValue = 1; +let increasingValue = 0; -for(let i = initialValue; i i > (variable.length / 2)).map(n => n+"\n").join("")); }); -test('You have to use for loop', () => { +test('You have to use a "for" loop', () => { const file = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); const regex = /for\s*/gm expect(regex.test(file.toString())).toBeTruthy(); -}) \ No newline at end of file +}) diff --git a/exercises/06.5-One-last-looping/README.es.md b/exercises/06.5-One-last-looping/README.es.md index d348cec6..810b349d 100644 --- a/exercises/06.5-One-last-looping/README.es.md +++ b/exercises/06.5-One-last-looping/README.es.md @@ -1,18 +1,18 @@ -# `06.5` Un último loop +# `06.5` One Last Looping ## 📝 Instrucciones: -1. Sin usar la función `array.reverse`, invierte el bucle (desde el final hasta el principio) todo el arreglo o array e imprime todos los elementos en la consola a medida que lo recorre. +1. Sin usar el método `reverse()`, invierte el bucle (desde el final hasta el principio) todo el array e imprime todos los elementos en la consola a medida que lo recorre. -## 💡 Pista: +## 💡 Pistas: -+ Usa un bucle `for ()` como lo hemos hecho en ejercicios anteriores. ++ Usa un bucle `for()` como lo hemos hecho en ejercicios anteriores. + Recuerda que los arreglos comienzan en la posición `0`. -### Resultado esperado: +## 💻 Resultado esperado: -```js +```text Annie Bart Cesco diff --git a/exercises/06.5-One-last-looping/README.md b/exercises/06.5-One-last-looping/README.md index 2447bb3b..5f6eda17 100644 --- a/exercises/06.5-One-last-looping/README.md +++ b/exercises/06.5-One-last-looping/README.md @@ -4,19 +4,19 @@ tutorial: https://www.youtube.com/watch?v=IwDDj6wN4jY # `06.5` One Last Looping - ## 📝 Instructions: -1. Without using the `array.reverse` function, please reverse loop (from the end to the beginning) the whole array and print all the items on the console as you go. -## 💡 Hint: +1. Without using the `reverse()` method, please reverse loop (from the end to the beginning) the whole array and print all the items on the console as you go. + +## 💡 Hints: + Use a `for()` loop like we have been using in previous exercises. + Remember that arrays start at position `0`. -### Expected result: +## 💻 Expected result: -```js +```text Annie Bart Cesco @@ -28,4 +28,4 @@ Lebron Ruth Kiko Esmeralda -``` \ No newline at end of file +``` diff --git a/exercises/06.5-One-last-looping/app.js b/exercises/06.5-One-last-looping/app.js index d1cd02be..13857e27 100644 --- a/exercises/06.5-One-last-looping/app.js +++ b/exercises/06.5-One-last-looping/app.js @@ -1,3 +1,3 @@ let mySampleArray = ['Esmeralda', 'Kiko', 'Ruth', 'Lebron', 'Pedro', 'Maria', 'Lou', 'Fernando', 'Cesco', 'Bart', 'Annie']; -//your code here \ No newline at end of file +// Your code here diff --git a/exercises/06.5-One-last-looping/solution.hide.js b/exercises/06.5-One-last-looping/solution.hide.js index c91984c5..9457630a 100644 --- a/exercises/06.5-One-last-looping/solution.hide.js +++ b/exercises/06.5-One-last-looping/solution.hide.js @@ -1,7 +1,7 @@ let mySampleArray = ['Esmeralda', 'Kiko', 'Ruth', 'Lebron', 'Pedro', 'Maria', 'Lou', 'Fernando', 'Cesco', 'Bart', 'Annie']; -//your code here -for (let i = mySampleArray.length - 1; i >= 0; i = i -1) { +// Your code here +for (let i = mySampleArray.length - 1; i >= 0; i = i - 1) { let item = mySampleArray[i]; console.log(item) -} \ No newline at end of file +} diff --git a/exercises/06.5-One-last-looping/tests.js b/exercises/06.5-One-last-looping/tests.js index 26d82060..92d5d9ad 100644 --- a/exercises/06.5-One-last-looping/tests.js +++ b/exercises/06.5-One-last-looping/tests.js @@ -8,7 +8,7 @@ global.console.log = console.log = jest.fn((text) => _buffer += text + "\n"); let reverse = Array.prototype.reverse; Array.prototype.reverse = jest.fn(function(){ return this; }); -test("Remember that your for loop must start by declaring a variable let or var", function(){ +test('Remember that your "for" loop must start by declaring a variable let or var', function(){ const content = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); expect(/for\s*\(\s*(let|var)\s*/.test(content)).toBe(true) }) @@ -27,7 +27,7 @@ test('Do not use the reverse function', function () { expect(appContent.includes('.reverse(')).toBe(false); }); -test('Loop the array in a reverse order and console.log all of its item', function () { +test('Loop the array in a reverse order and console.log all of its items', function () { const _app = rewire('./app.js'); const variable = _app.__get__('mySampleArray'); let inverted = []; @@ -35,4 +35,4 @@ test('Loop the array in a reverse order and console.log all of its item', functi inverted.push(variable[i]); } expect(_buffer).toMatch(inverted.map(n => n+"\n").join("")); -}); \ No newline at end of file +}); diff --git a/exercises/07.1-Finding-Waldo/README.es.md b/exercises/07.1-Finding-Waldo/README.es.md index 35d371f8..c5fa24f3 100644 --- a/exercises/07.1-Finding-Waldo/README.es.md +++ b/exercises/07.1-Finding-Waldo/README.es.md @@ -1,18 +1,18 @@ -# `07.1` Encuentra a Waldo (Wally) :smile: +# `07.1` Finding Waldo 😄 ![Finding Waldo](../../.learn/assets/finding_waldo.jpeg) -¿Alguna vez has jugado a encontrar a Waldo (o Wally)? Solía jugar mucho cuando era pequeño, este ejercicio es una versión digital de encontrar a Waldo. +¿Alguna vez has jugado "Dónde Está Waldo?" Solía jugar mucho cuando era pequeño, este ejercicio es una versión digital de encontrar a Waldo. -## :pencil: Instrucciones: +## 📝 Instrucciones: -1. Haz un bucle en este arreglo o array que lo recorra por completo e imprima las posiciones donde se encuentra el string "Waldo". +1. Haz un bucle en este array que lo recorra por completo e imprima las posiciones donde se encuentra el string "Waldo". -### :bulb: Pista +## 💡 Pistas: -+ Necesitas agregar un condicional dentro del bucle.. ++ Necesitas agregar un condicional dentro del bucle. -+ Waldo puede ser mayúscula o minúscula, compara ambos valores [usando toLowerCase()](https://www.geeksforgeeks.org/compare-the-case-insensitive-strings-in-javascript/) ++ Waldo puede ser mayúscula o minúscula, compara ambos valores [usando toLowerCase()](https://www.geeksforgeeks.org/compare-the-case-insensitive-strings-in-javascript/). -### :egg: Easter Egg: +## 🥚 Easter Egg: -¿Qué pasa si hay más de un Waldo? \ No newline at end of file ++ ¿Qué pasa si hay más de un Waldo? diff --git a/exercises/07.1-Finding-Waldo/README.md b/exercises/07.1-Finding-Waldo/README.md index c1fd8fc9..00627024 100644 --- a/exercises/07.1-Finding-Waldo/README.md +++ b/exercises/07.1-Finding-Waldo/README.md @@ -2,22 +2,22 @@ tutorial: https://www.youtube.com/watch?v=5WphKLyEJaU --- -# `07.1` Find Waldo :smile: +# `07.1` Finding Waldo 😄 ![Finding Waldo](../../.learn/assets/finding_waldo.jpeg) -Have you ever played finding Waldo? I used to play it a lot when I was little, this exercise is a digital version of finding Waldo. +Have you ever played "Where's Waldo?" I used to play it a lot when I was little, this exercise is a digital version of Where's Waldo. -## :pencil: Instructions: +## 📝 Instructions: 1. Please loop this entire array and print the positions where the string "Waldo" is found. -### :bulb: Hint +## 💡 Hints: + You need to add a conditional inside the loop. -+ Waldo may be upper case or lowercase, compare both values [using toLowerCase()](https://www.geeksforgeeks.org/compare-the-case-insensitive-strings-in-javascript/) ++ Waldo may be uppercase or lowercase, compare both values [using toLowerCase()](https://www.geeksforgeeks.org/compare-the-case-insensitive-strings-in-javascript/). -### :egg: Easter Egg: +## 🥚 Easter Egg: -What if there is more than one Waldo? ++ What if there is more than one Waldo? diff --git a/exercises/07.1-Finding-Waldo/app.js b/exercises/07.1-Finding-Waldo/app.js index 7c498a2b..e73f48e0 100644 --- a/exercises/07.1-Finding-Waldo/app.js +++ b/exercises/07.1-Finding-Waldo/app.js @@ -1,3 +1,3 @@ let people = [ 'Lebron','Aaliyah','Diamond','Dominique','Aliyah','Jazmin','Darnell','Hatfield','Hawkins','Hayden','Hayes','Haynes','Hays','Head','Heath','Hebert','Henderson','Hendricks','Hendrix','Henry','Hensley','Henson','Herman','Hernandez','Herrera','Herring','Hess','Hester','Hewitt','Hickman','Hicks','Higgins','Hill','Hines','Hinton','Hobbs','Hodge','Hodges','Hoffman','Hogan','Holcomb','Holden','Holder','Holland','Holloway','Holman','Holmes','Holt','Hood','Hooper','Hoover','Hopkins','Hopper','Horn','Horne','Horton','House','Houston','Howard','Howe','Howell','Hubbard','Huber','Hudson','Huff','Waldo','Hughes','Hull','Humphrey','Hunt','Hunter','Hurley','Hurst','Hutchinson','Hyde','Ingram','Irwin','Jackson','Jacobs','Jacobson','James','Jarvis','Jefferson','Jenkins','Jennings','Jensen','Jimenez','Johns','Johnson','Johnston','Jones','Jordan','Joseph','Joyce','Joyner','Juarez','Justice','Kane','Kaufman','Keith','Keller','Kelley','Kelly','Kemp','Kennedy','Kent','Kerr','Key','Kidd','Kim','King','Kinney','Kirby','Kirk','Kirkland','Klein','Kline','Knapp','Knight','Knowles','Knox','Koch','Kramer','Lamb','Lambert','Lancaster','Landry','Lane','Lang','Langley','Lara','Larsen','Larson','Lawrence','Lawson','Le','Leach','Leblanc','Lee','Leon','Leonard','Lester','Levine','Levy','Lewis','Lindsay','Lindsey','Little','Livingston','Lloyd','Logan','Long','Lopez','Lott','Love','Lowe','Lowery','Lucas','Luna','Lynch','Lynn','Lyons','Macdonald','Macias','Mack','Madden','Maddox','Maldonado','Malone','Mann','Manning','Marks','Marquez','Marsh','Marshall','Martin','Martinez','Mason','Massey','Mathews','Mathis','Matthews','Maxwell','May','Mayer','Maynard','Mayo','Mays','Mcbride','Mccall','Mccarthy','Mccarty','Mcclain','Mcclure','Mcconnell','Mccormick','Mccoy','Mccray','Waldo','Mcdaniel','Mcdonald','Mcdowell','Mcfadden','Mcfarland','Mcgee','Mcgowan','Mcguire','Mcintosh','Mcintyre','Mckay','Mckee','Mckenzie','Mckinney','Mcknight','Mclaughlin','Mclean','Mcleod','Mcmahon','Mcmillan','Mcneil','Mcpherson','Meadows','Medina','Mejia','Melendez','Melton','Mendez','Mendoza','Mercado','Mercer','Merrill','Merritt','Meyer','Meyers','Michael','Middleton','Miles','Miller','Mills','Miranda','Mitchell','Molina','Monroe','Lucas','Jake','Scott','Amy','Molly','Hannah','Lucas'] ; -//loop here to find waldo, use the if conditionals \ No newline at end of file +// Loop here to find waldo, use an if conditional inside the loop diff --git a/exercises/07.1-Finding-Waldo/solution.hide.js b/exercises/07.1-Finding-Waldo/solution.hide.js index 618a492b..f8cf4582 100644 --- a/exercises/07.1-Finding-Waldo/solution.hide.js +++ b/exercises/07.1-Finding-Waldo/solution.hide.js @@ -1,10 +1,10 @@ let people = [ 'Lebron','Aaliyah','Diamond','Dominique','Aliyah','Jazmin','Darnell','Hatfield','Hawkins','Hayden','Hayes','Haynes','Hays','Head','Heath','Hebert','Henderson','Hendricks','Hendrix','Henry','Hensley','Henson','Herman','Hernandez','Herrera','Herring','Hess','Hester','Hewitt','Hickman','Hicks','Higgins','Hill','Hines','Hinton','Hobbs','Hodge','Hodges','Hoffman','Hogan','Holcomb','Holden','Holder','Holland','Holloway','Holman','Holmes','Holt','Hood','Hooper','Hoover','Hopkins','Hopper','Horn','Horne','Horton','House','Houston','Howard','Howe','Howell','Hubbard','Huber','Hudson','Huff','Waldo','Hughes','Hull','Humphrey','Hunt','Hunter','Hurley','Hurst','Hutchinson','Hyde','Ingram','Irwin','Jackson','Jacobs','Jacobson','James','Jarvis','Jefferson','Jenkins','Jennings','Jensen','Jimenez','Johns','Johnson','Johnston','Jones','Jordan','Joseph','Joyce','Joyner','Juarez','Justice','Kane','Kaufman','Keith','Keller','Kelley','Kelly','Kemp','Kennedy','Kent','Kerr','Key','Kidd','Kim','King','Kinney','Kirby','Kirk','Kirkland','Klein','Kline','Knapp','Knight','Knowles','Knox','Koch','Kramer','Lamb','Lambert','Lancaster','Landry','Lane','Lang','Langley','Lara','Larsen','Larson','Lawrence','Lawson','Le','Leach','Leblanc','Lee','Leon','Leonard','Lester','Levine','Levy','Lewis','Lindsay','Lindsey','Little','Livingston','Lloyd','Logan','Long','Lopez','Lott','Love','Lowe','Lowery','Lucas','Luna','Lynch','Lynn','Lyons','Macdonald','Macias','Mack','Madden','Maddox','Maldonado','Malone','Mann','Manning','Marks','Marquez','Marsh','Marshall','Martin','Martinez','Mason','Massey','Mathews','Mathis','Matthews','Maxwell','May','Mayer','Maynard','Mayo','Mays','Mcbride','Mccall','Mccarthy','Mccarty','Mcclain','Mcclure','Mcconnell','Mccormick','Mccoy','Mccray','Waldo','Mcdaniel','Mcdonald','Mcdowell','Mcfadden','Mcfarland','Mcgee','Mcgowan','Mcguire','Mcintosh','Mcintyre','Mckay','Mckee','Mckenzie','Mckinney','Mcknight','Mclaughlin','Mclean','Mcleod','Mcmahon','Mcmillan','Mcneil','Mcpherson','Meadows','Medina','Mejia','Melendez','Melton','Mendez','Mendoza','Mercado','Mercer','Merrill','Merritt','Meyer','Meyers','Michael','Middleton','Miles','Miller','Mills','Miranda','Mitchell','Molina','Monroe','Lucas','Jake','Scott','Amy','Molly','Hannah','Lucas'] ; -//loop here to find Waldo, use the if conditionals +// Loop here to find waldo, use an if conditional inside the loop -for(let i =0;i 0).toBe(true); }); -it('Use a for loop', function () { +it('Use a "for" loop', function () { const app_content = fs.readFileSync(path.resolve(__dirname, './app.js'), 'utf8'); expect(app_content).toMatch(/for(\s*)\(/); }); @@ -23,9 +23,9 @@ it('Use the toLowerCase function', function () { expect(app_content).toMatch(/\.toLowerCase(\s*)\(/); }); -it('Loop and add a conditional to print the position (i) where Waldo was fund', function () { +it('Loop and add a conditional to print the position (i) where Waldo was found', function () { const _app = rewire('./app.js'); const people = _app.__get__('people'); const position = people.indexOf("Waldo"); expect(_buffer.includes(position+"\n")).toBe(true); -}); \ No newline at end of file +});