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 all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions 1-exercises/A-undefined/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
let a;
console.log(a);

//a is not defined


// Example 2
function sayHello() {
let message = "Hello";
}
// the message is not defined

let hello = sayHello();
console.log(hello);

// hello is not defined


// Example 3
function sayHelloToUser(user) {
Expand All @@ -30,7 +35,11 @@ function sayHelloToUser(user) {

sayHelloToUser();

//user is not defined


// Example 4
let arr = [1,2,3];
console.log(arr[3]);

// array no 3 does not exist
10 changes: 10 additions & 0 deletions 1-exercises/B-while-loop/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

function evenNumbers(n) {
// TODO
let array = [];
let i = 0;
while (n > array.length) {
if (i % 2 === 0) {
array.push(i);
}
i++;
}

console.log(array);
}

evenNumbers(3); // should output 0,2,4
Expand Down
5 changes: 5 additions & 0 deletions 1-exercises/C-while-loop-with-array/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ 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"
2 changes: 0 additions & 2 deletions 1-exercises/D-do-while/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

function evenNumbersSum(n) {
// TODO
}

console.log(evenNumbersSum(3)); // should output 6
console.log(evenNumbersSum(0)); // should output 0
console.log(evenNumbersSum(10)); // should output 90