Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions 1-exercises/A-undefined/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// Example 1
let a;
console.log(a);
console.log(a); //value is not asigned


// Example 2
Expand All @@ -20,17 +20,17 @@ function sayHello() {
}

let hello = sayHello();
console.log(hello);
console.log(hello); //sayHello() function does not have a return statement

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice One


// Example 3
function sayHelloToUser(user) {
console.log(`Hello ${user}`);
}

sayHelloToUser();
sayHelloToUser(); //sayHelloToUser() function is not given a value when the function is called


// Example 4
let arr = [1,2,3];
console.log(arr[3]);
console.log(arr[3]); //array contains only 3 elements and indices like 0,1,2 when we write arr[3] it means that we whant to reach the element number 4 which does not exist here.
4 changes: 2 additions & 2 deletions 1-exercises/B-array-literals/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Declare some variables assigned to arrays of values
*/

let numbers = []; // add numbers from 1 to 10 into this array
let mentors; // Create an array with the names of the mentors: Daniel, Irina and Rares
let numbers = [1,2,3,4,5,6,7,8,9,10]; // add numbers from 1 to 10 into this array
let mentors = ['Daniel', 'Irina', 'Rares']; // Create an array with the names of the mentors: Daniel, Irina and Rares

/*
DO NOT EDIT BELOW THIS LINE
Expand Down
4 changes: 2 additions & 2 deletions 1-exercises/C-array-get-set/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

function first(arr) {
return; // complete this statement
return arr[0]; // complete this statement
}

function last(arr) {
return; // complete this statement
return arr[arr.length - 1 ]; // complete this statement
}

/*
Expand Down
3 changes: 2 additions & 1 deletion 1-exercises/C-array-get-set/exercises2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

let numbers = [1, 2, 3]; // Don't change this array literal declaration

numbers.push(4);
numbers[0] = 1;
/*
DO NOT EDIT BELOW THIS LINE
--------------------------- */
Expand Down
4 changes: 3 additions & 1 deletion 1-exercises/D-for-loop/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const AGES = [
];

// TODO - Write for loop code here

for(let i = 0; i < WRITERS.length; i++){
console.log(`${WRITERS[i]} is ${AGES[i]} years old`);
}
/*
The output should look something like this:

Expand Down
8 changes: 8 additions & 0 deletions 1-exercises/E-while-loop-with-array/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ const BIRTHDAYS = [

function findFirstJulyBDay(birthdays) {
// TODO
let i = 0;
while (i < BIRTHDAYS.length){
if(BIRTHDAYS[i].includes("July")){
return BIRTHDAYS[i];
}
i++;
}

}

console.log(findFirstJulyBDay(BIRTHDAYS)); // should output "July 11th"