Skip to content

Commit

Permalink
Merge pull request #136 from josemoracard/jose3-01-hello_world
Browse files Browse the repository at this point in the history
exercises 01-hello-world to 07.1-finding-waldo
  • Loading branch information
alesanchezr authored Sep 6, 2023
2 parents 7054e65 + 357d5c3 commit ea6cf33
Show file tree
Hide file tree
Showing 63 changed files with 208 additions and 239 deletions.
6 changes: 3 additions & 3 deletions exercises/01-Hello_World/README.es.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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:

Expand Down
10 changes: 5 additions & 5 deletions exercises/01-Hello_World/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
2 changes: 1 addition & 1 deletion exercises/01-Hello_World/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 10 additions & 10 deletions exercises/02.1-Access_and_retrieve/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
13 changes: 7 additions & 6 deletions exercises/02.1-Access_and_retrieve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,31 @@ 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)

To access any item within the array you need to know its index (position). The index is an integer value that represents the position in which the element is located.

**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`.

Expand Down
8 changes: 4 additions & 4 deletions exercises/02.1-Access_and_retrieve/app.js
Original file line number Diff line number Diff line change
@@ -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
// 3. print the position of step 2
14 changes: 7 additions & 7 deletions exercises/02.1-Access_and_retrieve/solution.hide.js
Original file line number Diff line number Diff line change
@@ -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])
// 3. print the position of step 2
console.log(myArray[4]);
6 changes: 3 additions & 3 deletions exercises/02.1-Access_and_retrieve/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
});
8 changes: 4 additions & 4 deletions exercises/02.2-Retrieve_Items/README.es.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# `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:

```js
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.
2. Imprima en la consola el 4to elemento del array.
6 changes: 3 additions & 3 deletions exercises/02.2-Retrieve_Items/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.
2 changes: 1 addition & 1 deletion exercises/02.2-Retrieve_Items/app.js
Original file line number Diff line number Diff line change
@@ -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
// your code here
9 changes: 3 additions & 6 deletions exercises/02.2-Retrieve_Items/solution.hide.js
Original file line number Diff line number Diff line change
@@ -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]);
console.log(arr[3]);
4 changes: 2 additions & 2 deletions exercises/02.2-Retrieve_Items/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ 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);
});

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);
});
});
4 changes: 2 additions & 2 deletions exercises/03-Print_the_last_one/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
2. Luego, imprímelo en la consola.
6 changes: 3 additions & 3 deletions exercises/03-Print_the_last_one/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion exercises/03-Print_the_last_one/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function generateRandomArray()
}
let myStupidArray = generateRandomArray();

//Your code here
// Your code here
4 changes: 2 additions & 2 deletions exercises/03-Print_the_last_one/solution.hide.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ function generateRandomArray()
{
let auxArray = [];
let randomLength = Math.floor(Math.random()*100);
for(let i = 0;i<randomLength;i++) auxArray.push(Math.floor(Math.random()*100));
for(let i = 0; i < randomLength; i++) auxArray.push(Math.floor(Math.random()*100));
return auxArray;
}
let myStupidArray = generateRandomArray();

// 0. 1. 2
// Your code here
let theLastOne = myStupidArray[myStupidArray.length - 1];
console.log(theLastOne)

8 changes: 4 additions & 4 deletions exercises/04.1-Loop_from_one_to_seventeen/README.es.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# `04.1` Loop from one to seventeen

El loop (bucle) actual se repite del cero a diez,
El loop (bucle) actual se repite del cero a diez.

## 📝 Instrucciones:

1. Por favor, haz un loop de 1 a 17.

## Ejemplo de salida:
## 💻 Ejemplo de salida:

```js
1
Expand All @@ -28,8 +28,8 @@ El loop (bucle) actual se repite del cero a diez,
17
```

## 💡 Pista:
## 💡 Pistas:

+ Tienes que recorrer del 1 al 17 (no del 0 al 17).

+ Aquí esta un [video de 2 min explicando como hacer un loop](https://www.youtube.com/watch?v=s9wW2PpJsmQ).
+ Aquí está un [video de 6 minutos explicando como hacer un loop](https://www.youtube.com/watch?v=s9wW2PpJsmQ).
8 changes: 4 additions & 4 deletions exercises/04.1-Loop_from_one_to_seventeen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ tutorial: https://www.youtube.com/watch?v=4QGaROXZ3oc

# `04.1` Loop from one to seventeen

The current loop is looping from zero to ten,
The current loop is looping from zero to ten.

## 📝 Instructions
## 📝 Instructions:

1. Please make it loop from 1 to 17.

## Example output:
## 💻 Example output:

```js
1
Expand All @@ -36,4 +36,4 @@ The current loop is looping from zero to ten,

+ You have to loop from 1 to 17 (not from 0 to 17).

+ Here is a [2 minute video explaining how to loop](https://www.youtube.com/watch?v=s9wW2PpJsmQ).
+ Here is a [6 minute video explaining how to loop](https://www.youtube.com/watch?v=s9wW2PpJsmQ).
6 changes: 3 additions & 3 deletions exercises/04.1-Loop_from_one_to_seventeen/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//change the conditions of the for loop
for(let number = 0; number < 10; number++){
//print the number
// Change the conditions of the for loop
for(let number = 0; number < 10; number++) {
// Print the number
}
Loading

0 comments on commit ea6cf33

Please sign in to comment.