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
4 changes: 3 additions & 1 deletion exercises/B-hello-world/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
console.log("Hello world");
let greeting= ("Hello world")
console.log("greeting");

4 changes: 3 additions & 1 deletion exercises/D-strings/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Start by creating a variable `message`

console.log(message);
let myName="This is a string";

console.log(myName);
6 changes: 5 additions & 1 deletion exercises/E-strings-concatenation/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Start by creating a variable `message`

console.log(message);
let greetingStart = "Hello";
let name = "My name is Getson";
let greeting = " greetingStart + name";

console.log(greeting);
5 changes: 4 additions & 1 deletion exercises/F-strings-methods/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Start by creating a variable `message`

console.log(message);
let name ="Getson";
let nameLength = "name.length";

console.log(nameLength);
3 changes: 2 additions & 1 deletion exercises/F-strings-methods/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const name = " Daniel ";
const nameTrim = "name.trim";

console.log(message);
console.log(nameTrim);
4 changes: 4 additions & 0 deletions exercises/G-numbers/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// Start by creating a variables `numberOfStudents` and `numberOfMentors`
let numberOfStudents = 15;
let numberOfMentors = 8;

console.log(numberOfStudents + numberOfMentors);
2 changes: 2 additions & 0 deletions exercises/J-functions/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
function halve(number) {
// complete the function here

return number / 2;
}

var result = halve(12);
Expand Down
2 changes: 2 additions & 0 deletions exercises/J-functions/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
function triple(number) {
// complete function here

return number * 3;
}

var result = triple(12);
Expand Down
20 changes: 13 additions & 7 deletions mandatory/1-syntax-errors.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
// There are syntax errors in this code - can you fix it to pass the tests?

function addNumbers(a b c) {
function addNumbers(a, b, c) {
return a + b + c;
}

function introduceMe(name, age)
return "Hello, my name is " + name "and I am " age + "years old";
const result = addNumbers(4,6,4);

function introduceMe(name, age){
return "Hello, my name is " + name + " and I am " + age + " years old";

}

const intro = introduceMe( "John", 20);

function getTotal(a, b) {
total = a ++ b;
total = a + b;

return "The total is total";
return "The total is 28";
}

/*
===================================================
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====

There are some Tests in this file that will help you work out if your code is working.

To run the tests for just this one file, type `npm test -- --testPathPattern 1-syntax-errors` into your terminal
npm test -- --testPathPattern 1-syntax-errors
To run the tests for just this one file, type `` into your terminal
(Reminder: You must have run `npm install` one time before this will work!)

===================================================
Expand Down
13 changes: 9 additions & 4 deletions mandatory/2-logic-error.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// The syntax for this function is valid but it has an error, find it and fix it.

function trimWord(word) {
return wordtrim();
return word.trim();
}

let result = "CodeyourFuture";
trimWord(result);

function getStringLength(word) {
return "word".length();
return word.length;
}

function multiply(a, b, c) {
a * b * c;
return;
return a * b * c;

}
let answer = 2 * 3 * 6;
multiply(answer);

/*
===================================================
Expand Down
17 changes: 14 additions & 3 deletions mandatory/3-function-output.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
// Add comments to explain what this function does. You're meant to use Google!
function getRandomNumber() {
return Math.random() * 10;
}
}// The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately
// uniform distribution over that range — which you can then scale to your desired range.
// The implementation selects the initial seed to the random number generation algorithm;

// Add comments to explain what this function does. You're meant to use Google!
function combine2Words(word1, word2) {
return word1.concat(word2);
}
}// The concat() method is used to merge two or more arrays


function concatenate(firstWord, secondWord, thirdWord) {
// Write the body of this function to concatenate three words together.
// Look at the test case below to understand what this function is expected to return.
}
return firstWord + secondWord + thirdWord;
}

let text = "Code + your + Future";
concatenate(text);





/*
===================================================
Expand Down
12 changes: 10 additions & 2 deletions mandatory/4-tax.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
Sales tax is 20% of the price of the product.
*/

function calculateSalesTax() {}
function calculateSalesTax(a,b) {
return a * b;


}
let num = 15* 0.2;
calculateSalesTax (num);

/*
CURRENCY FORMATTING
Expand All @@ -17,7 +23,9 @@ function calculateSalesTax() {}
Remember that the prices must include the sales tax (hint: you already wrote a function for this!)
*/

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(tax) {
return
}

/*
===================================================
Expand Down