Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Closed
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
3 changes: 3 additions & 0 deletions 1-exercises/A-undefined/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
// Example 1
let a;
console.log(a);
function has no parimeter


// Example 2
function sayHello() {
let message = "Hello";
needed to return message
}

let hello = sayHello();
Expand All @@ -29,6 +31,7 @@ function sayHelloToUser(user) {
}

sayHelloToUser();
needs a parimeter


// Example 4
Expand Down
11 changes: 7 additions & 4 deletions 1-exercises/E-for-loop/exercise1.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@


// Change the below code to use a for loop instead of a while loop.
let i = 0;
while(i < 26) {
console.log(String.fromCharCode(97 + i));
i++;

for (let index = 0; index < 26; index++) {

console.log(String.fromCharCode(97 + index));

}


// The output shouldn't change.
5 changes: 4 additions & 1 deletion 1-exercises/E-for-loop/exercise2.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const AGES = [
];

// TODO - Write for loop code here

for (let index = 0; index < WRITERS.length; index++) {
console.log(`${WRITERS[index]} is ${AGES[index]} years old`);

}
/*
The output should look something like this:

Expand Down
1 change: 0 additions & 1 deletion 1-exercises/F-for-of-loop/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ let tubeStations = [
"Tottenham Court Road"
];


// TODO Use a for-of loop to capitalise and output each letter in the string seperately.
let str = "codeyourfuture";
6 changes: 6 additions & 0 deletions 2-mandatory/1-weather-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

function getTemperatureReport(cities) {
// TODO
let final = []
for (let index = 0; index < cities.length; index++) {
final.push(`The temperature in ${cities[index]} is ${temperatureService(cities[index])} degrees`);

}
return final
}


Expand Down
7 changes: 6 additions & 1 deletion 3-extra/1-factorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
*/

function factorial(input) {
// TODO
let result = 1
for (let i = 1; i <= input; i++) {
result *= i
}
return result

}

/* ======= TESTS - DO NOT MODIFY ===== */
Expand Down
14 changes: 13 additions & 1 deletion 3-extra/3-fibonacci.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@
*/

function generateFibonacciSequence(n) {
// TODO
let start = 0
let final =[]
let next =1
let current
for (let i = 0; i < n; i++) {
final.push(start)
current = start + next
start = next
next = current


}
return final
}

/* ======= TESTS - DO NOT MODIFY ===== */
Expand Down