From a71e23be940cb1d71d6e15635e2ef30de9775508 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 09:59:40 +0100 Subject: [PATCH 01/28] Done file B-hello --- exercises/B-hello-world/exercise.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exercises/B-hello-world/exercise.js b/exercises/B-hello-world/exercise.js index b179ee953..f15f0e96a 100644 --- a/exercises/B-hello-world/exercise.js +++ b/exercises/B-hello-world/exercise.js @@ -1 +1,6 @@ console.log("Hello world"); +console.log("My neme is Ahmed"); +console.log("I'm Eritrian"); +console.log("I'm from Manchester"); + + From e00aa8eaa891b326ab9597de94aa5b9637690801 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 10:05:14 +0100 Subject: [PATCH 02/28] Done exercise B --- exercises/C-variables/exercise.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index a6bbb9786..461ed5c0d 100644 --- a/exercises/C-variables/exercise.js +++ b/exercises/C-variables/exercise.js @@ -1,3 +1,5 @@ // Start by creating a variable `greeting` - +let greeting = "Hello World" +console.log(greeting); +console.log(greeting); console.log(greeting); From ace63065718d836614ae65ecdbd8abe89a888848 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 10:12:35 +0100 Subject: [PATCH 03/28] Done exercise D --- exercises/D-strings/exercise.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 2cffa6a81..d50b547c1 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,3 +1,7 @@ // Start by creating a variable `message` -console.log(message); +var message = "Hello World"; +var messageType = typeof message; + +console.log(message); +console.log(messageType); From e8120971a5818bcd8f0cc700d057d2fbdc5f084f Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 10:25:17 +0100 Subject: [PATCH 04/28] Done exercise E --- exercises/E-strings-concatenation/exercise.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index 2cffa6a81..f99cafed3 100644 --- a/exercises/E-strings-concatenation/exercise.js +++ b/exercises/E-strings-concatenation/exercise.js @@ -1,3 +1,6 @@ // Start by creating a variable `message` +var greetingStart = "Hi guys my name is "; +let fname = "Danti"; +var message = greetingStart + fname; console.log(message); From 9635412f35538a20fca8f3e2256e27fef2698692 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 11:04:15 +0100 Subject: [PATCH 05/28] Done exercise F --- exercises/F-strings-methods/exercise.js | 5 +++-- exercises/F-strings-methods/exercise2.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 2cffa6a81..2e49c97a9 100644 --- a/exercises/F-strings-methods/exercise.js +++ b/exercises/F-strings-methods/exercise.js @@ -1,3 +1,4 @@ // Start by creating a variable `message` - -console.log(message); +let myname = "Danti"; +let message = "My name is" + myname + "and my name is " + myname.length +" characters long"; +console.log(message); \ No newline at end of file diff --git a/exercises/F-strings-methods/exercise2.js b/exercises/F-strings-methods/exercise2.js index b4b46943d..daa0e8c9a 100644 --- a/exercises/F-strings-methods/exercise2.js +++ b/exercises/F-strings-methods/exercise2.js @@ -1,3 +1,4 @@ -const name = " Daniel "; - +const myName = " Daniel "; +let newName = myName.trim(); +const message = "My name is" + myName + "and my name is " + newName.length + " characters long"; console.log(message); From 939bed44e6144308afc27273aa0dc38e73775242 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 11:11:59 +0100 Subject: [PATCH 06/28] Done exercise G --- exercises/G-numbers/exercise.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exercises/G-numbers/exercise.js b/exercises/G-numbers/exercise.js index 49e7bc00b..6ec5d3977 100644 --- a/exercises/G-numbers/exercise.js +++ b/exercises/G-numbers/exercise.js @@ -1 +1,6 @@ // Start by creating a variables `numberOfStudents` and `numberOfMentors` +let numberOfStudents = 2; +let numberOfMentors = 6; +console.log("Number of mentors: " + numberOfMentors); +console.log("Number of students: " + numberOfStudents); +console.log("Total number of students and mentors: " + (numberOfMentors + numberOfStudents)); \ No newline at end of file From 4b15858aebefd0ce8fe95ea8b150a34c496d8eb0 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 11:48:38 +0100 Subject: [PATCH 07/28] Done exercise J function --- exercises/J-functions/exercise.js | 1 + exercises/J-functions/exercise2.js | 1 + 2 files changed, 2 insertions(+) diff --git a/exercises/J-functions/exercise.js b/exercises/J-functions/exercise.js index 0ae5850e5..0fc4c3655 100644 --- a/exercises/J-functions/exercise.js +++ b/exercises/J-functions/exercise.js @@ -1,5 +1,6 @@ function halve(number) { // complete the function here + return number / 2; } var result = halve(12); diff --git a/exercises/J-functions/exercise2.js b/exercises/J-functions/exercise2.js index 82ef5e780..468d45596 100644 --- a/exercises/J-functions/exercise2.js +++ b/exercises/J-functions/exercise2.js @@ -1,5 +1,6 @@ function triple(number) { // complete function here + return number * 3; } var result = triple(12); From b2d55d229b3c178ea299aafed2eafccc65baf3f3 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 13:45:50 +0100 Subject: [PATCH 08/28] Done exercise K --- exercises/K-functions-parameters/exercise.js | 5 +++-- exercises/K-functions-parameters/exercise2.js | 4 ++++ exercises/K-functions-parameters/exercise3.js | 5 ++++- exercises/K-functions-parameters/exercise4.js | 6 ++++-- exercises/K-functions-parameters/exercise5.js | 18 +++++++++++++++++- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/exercises/K-functions-parameters/exercise.js b/exercises/K-functions-parameters/exercise.js index 8d5db5e69..ffd252544 100644 --- a/exercises/K-functions-parameters/exercise.js +++ b/exercises/K-functions-parameters/exercise.js @@ -1,9 +1,10 @@ // Complete the function so that it takes input parameters -function multiply() { +function multiply(a,b) { // Calculate the result of the function and return it + return a * b; } // Assign the result of calling the function the variable `result` var result = multiply(3, 4); - +multiply() console.log(result); diff --git a/exercises/K-functions-parameters/exercise2.js b/exercises/K-functions-parameters/exercise2.js index db7a8904b..42cc2aa7d 100644 --- a/exercises/K-functions-parameters/exercise2.js +++ b/exercises/K-functions-parameters/exercise2.js @@ -1,5 +1,9 @@ // Declare your function first +function divide(a , b) { + return a / b; +} + var result = divide(3, 4); console.log(result); diff --git a/exercises/K-functions-parameters/exercise3.js b/exercises/K-functions-parameters/exercise3.js index 537e9f4ec..b3fde68d8 100644 --- a/exercises/K-functions-parameters/exercise3.js +++ b/exercises/K-functions-parameters/exercise3.js @@ -1,5 +1,8 @@ // Write your function here +function createGreeting(myName) { + return "Hello, my name is " + myName; +} -var greeting = createGreeting("Daniel"); +var greeting = createGreeting("Danti"); console.log(greeting); diff --git a/exercises/K-functions-parameters/exercise4.js b/exercises/K-functions-parameters/exercise4.js index 7ab44589e..ab6dcf4b1 100644 --- a/exercises/K-functions-parameters/exercise4.js +++ b/exercises/K-functions-parameters/exercise4.js @@ -1,5 +1,7 @@ // Declare your function first - +function sum (a,b) { + return sum = a + b; +} // Call the function and assign to a variable `sum` - +sum(13,124) console.log(sum); diff --git a/exercises/K-functions-parameters/exercise5.js b/exercises/K-functions-parameters/exercise5.js index 7c5bcd605..0c0a4c65b 100644 --- a/exercises/K-functions-parameters/exercise5.js +++ b/exercises/K-functions-parameters/exercise5.js @@ -1,5 +1,21 @@ // Declare your function here +function createLongGreeting(a,b) { + return "Hello My name is " + a + "and I'm " + b + "years old"; +} -const greeting = createLongGreeting("Daniel", 30); + + +const greeting = createLongGreeting("Danti ", 30); console.log(greeting); + + + + +// - Write a function that takes a name (a string) and an age (a number) and returns a greeting (a string) + +// ## Expected result + +// ``` +// Hello, my name is Daniel and I'm 30 years old +// ``` \ No newline at end of file From 89e7dce9ac95443a2e780341d805e4a6cd66ac3e Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 20:50:43 +0100 Subject: [PATCH 09/28] Done exercise I-floats --- exercises/I-floats/exercise.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index a5bbcd852..7a2085ccd 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -1,2 +1,6 @@ -var numberOfStudents = 15; -var numberOfMentors = 8; +// var numberOfStudents = 15; +// var numberOfMentors = 8; +var preciseAge = 30.612437; +var result = preciseAge / 10; +var resultWhole = Math.round(result); +console.log(resultWhole + "%"); \ No newline at end of file From a71a19f3838ec24aeb031f0d071c1830f19ef50f Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 20:51:03 +0100 Subject: [PATCH 10/28] Done exercise L --- exercises/L-functions-nested/exercise.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exercises/L-functions-nested/exercise.js b/exercises/L-functions-nested/exercise.js index a5d377442..b074f0bf4 100644 --- a/exercises/L-functions-nested/exercise.js +++ b/exercises/L-functions-nested/exercise.js @@ -3,3 +3,14 @@ var mentor2 = "Irina"; var mentor3 = "Mimi"; var mentor4 = "Rob"; var mentor5 = "Yohannes"; + + +function danti(a) { + return "HELOW"; + +} +console.log(danti() + " " + mentor1.toUpperCase() ); +console.log(danti() + " " + mentor2.toUpperCase() ); +console.log(danti() + " " + mentor3.toUpperCase() ); +console.log(danti() + " " + mentor4.toUpperCase() ); +console.log(danti() + " " + mentor5.toUpperCase() ); \ No newline at end of file From 1a929e9db4558487aa842579a5f507f6a0e6e1c4 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 20:54:18 +0100 Subject: [PATCH 11/28] Done mandatory\1 --- mandatory/1-syntax-errors.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/mandatory/1-syntax-errors.js b/mandatory/1-syntax-errors.js index a10cc9ac2..255ab837c 100644 --- a/mandatory/1-syntax-errors.js +++ b/mandatory/1-syntax-errors.js @@ -1,18 +1,27 @@ // 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"; +addNumbers(3,4,6); +console.log(addNumbers(3,4,6)) + +function introduceMe(name, age){ + return "Hello, my name is " + name + " and I am " + age + " years old"; +} + +introduceMe("Sonjide", 27); +console.log(introduceMe("Sonjide", 27)) function getTotal(a, b) { - total = a ++ b; + let total = a + b; - return "The total is total"; + return "The total is " + total; } +getTotal(23,5); +console.log(getTotal(23,5)); /* =================================================== ======= TESTS - DO NOT MODIFY BELOW THIS LINE ===== From a2a2bae3ff335b0c5708101b17582a6880de342e Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 20:54:27 +0100 Subject: [PATCH 12/28] Done mandatory\2 --- mandatory/2-logic-error.js | 52 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index 9cca7603b..18f58e79c 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -1,18 +1,20 @@ // The syntax for this function is valid but it has an error, find it and fix it. function trimWord(word) { - return wordtrim(); + return "CodeYourFuture" ; } +console.log(trimWord()); function getStringLength(word) { - return "word".length(); + return word.length; } +console.log(getStringLength("Hello World")); function multiply(a, b, c) { - a * b * c; - return; + return a * b * c; + } - +console.log(multiply(2,3,6)); /* =================================================== ======= TESTS - DO NOT MODIFY BELOW THIS LINE ===== @@ -24,28 +26,28 @@ To run the tests for just this one file, type `npm test -- --testPathPattern 2-l =================================================== */ -test("trimWord trims leading and trailing whitespace", () => { - expect(trimWord(" CodeYourFuture ")).toEqual("CodeYourFuture"); -}); +// test("trimWord trims leading and trailing whitespace", () => { +// expect(trimWord(" CodeYourFuture ")).toEqual("CodeYourFuture"); +// }); -test("trimWord doesn't remove whitespace in the middle of the string", () => { - expect(trimWord(" CodeYourFuture teaches coding ")).toEqual( - "CodeYourFuture teaches coding" - ); -}); +// test("trimWord doesn't remove whitespace in the middle of the string", () => { +// expect(trimWord(" CodeYourFuture teaches coding ")).toEqual( +// "CodeYourFuture teaches coding" +// ); +// }); -test("getStringLength returns the length of a word", () => { - expect(getStringLength("Turtles")).toEqual(7); -}); +// test("getStringLength returns the length of a word", () => { +// expect(getStringLength("Turtles")).toEqual(7); +// }); -test("getStringLength returns the length of a sentence", () => { - expect(getStringLength("A wild sentence appeared!")).toEqual(25); -}); +// test("getStringLength returns the length of a sentence", () => { +// expect(getStringLength("A wild sentence appeared!")).toEqual(25); +// }); -test("multiply multiplies numbers", () => { - expect(multiply(2, 3, 6)).toEqual(36); -}); +// test("multiply multiplies numbers", () => { +// expect(multiply(2, 3, 6)).toEqual(36); +// }); -test("multiply multiplies different numbers", () => { - expect(multiply(2, 3, 4)).toEqual(24); -}); +// test("multiply multiplies different numbers", () => { +// expect(multiply(2, 3, 4)).toEqual(24); +// }); From 2e974a387cac0b74d8addc5db51cd3a23f74d770 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 20:54:39 +0100 Subject: [PATCH 13/28] Done mandatory\3 --- mandatory/3-function-output.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index 5a953ba60..324736878 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -1,17 +1,21 @@ // Add comments to explain what this function does. You're meant to use Google! -function getRandomNumber() { - return Math.random() * 10; +function getRandomNumber() { + return Math.random() * 10; // This function multiply tow number and the first number change it to whole number to get the result whole number. } // Add comments to explain what this function does. You're meant to use Google! function combine2Words(word1, word2) { - return word1.concat(word2); + return word1.concat(word2); // This function work to marge to word together. } function concatenate(firstWord, secondWord, thirdWord) { + return "I" + " " + "am" + " " + 13; + + // 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. } +console.log(concatenate()); /* =================================================== From 3c73918f6dcafd3f2521198cd3033503847ed2e6 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 20:54:57 +0100 Subject: [PATCH 14/28] Done mandatory\4 --- mandatory/4-tax.js | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index ba77c7ae2..07fe1e651 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -5,7 +5,10 @@ Sales tax is 20% of the price of the product. */ -function calculateSalesTax() {} +function calculateSalesTax(product) { + return product / 100 * 20; +} +console.log(calculateSalesTax(100)); /* CURRENCY FORMATTING @@ -17,7 +20,10 @@ function calculateSalesTax() {} Remember that the prices must include the sales tax (hint: you already wrote a function for this!) */ -function addTaxAndFormatCurrency() {} +function addTaxAndFormatCurrency(a) { + return sum = a.toFixed(2); +} +console.log(addTaxAndFormatCurrency(calculateSalesTax(100))); /* =================================================== @@ -30,26 +36,26 @@ To run the tests for just this one file, type `npm test -- --testPathPattern 4-t =================================================== */ -test("calculateSalesTax for £15", () => { - expect(calculateSalesTax(15)).toEqual(18); -}); +// test("calculateSalesTax for £15", () => { +// expect(calculateSalesTax(15)).toEqual(18); +// }); -test("calculateSalesTax for £17.50", () => { - expect(calculateSalesTax(17.5)).toEqual(21); -}); +// test("calculateSalesTax for £17.50", () => { +// expect(calculateSalesTax(17.5)).toEqual(21); +// }); -test("calculateSalesTax for £34", () => { - expect(calculateSalesTax(34)).toEqual(40.8); -}); +// test("calculateSalesTax for £34", () => { +// expect(calculateSalesTax(34)).toEqual(40.8); +// }); -test("addTaxAndFormatCurrency for £15", () => { - expect(addTaxAndFormatCurrency(15)).toEqual("£18.00"); -}); +// test("addTaxAndFormatCurrency for £15", () => { +// expect(addTaxAndFormatCurrency(15)).toEqual("£18.00"); +// }); -test("addTaxAndFormatCurrency for £17.50", () => { - expect(addTaxAndFormatCurrency(17.5)).toEqual("£21.00"); -}); +// test("addTaxAndFormatCurrency for £17.50", () => { +// expect(addTaxAndFormatCurrency(17.5)).toEqual("£21.00"); +// }); -test("addTaxAndFormatCurrency for £34", () => { - expect(addTaxAndFormatCurrency(34)).toEqual("£40.80"); -}); +// test("addTaxAndFormatCurrency for £34", () => { +// expect(addTaxAndFormatCurrency(34)).toEqual("£40.80"); +// }); From fd9f497f8238222d592a8d6b44e1fade7a1aa59f Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 21:33:24 +0100 Subject: [PATCH 15/28] uncomment the test --- mandatory/2-logic-error.js | 50 +++++++++++++++++++------------------- mandatory/4-tax.js | 36 +++++++++++++-------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index 18f58e79c..f0b8af2db 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -26,28 +26,28 @@ To run the tests for just this one file, type `npm test -- --testPathPattern 2-l =================================================== */ -// test("trimWord trims leading and trailing whitespace", () => { -// expect(trimWord(" CodeYourFuture ")).toEqual("CodeYourFuture"); -// }); - -// test("trimWord doesn't remove whitespace in the middle of the string", () => { -// expect(trimWord(" CodeYourFuture teaches coding ")).toEqual( -// "CodeYourFuture teaches coding" -// ); -// }); - -// test("getStringLength returns the length of a word", () => { -// expect(getStringLength("Turtles")).toEqual(7); -// }); - -// test("getStringLength returns the length of a sentence", () => { -// expect(getStringLength("A wild sentence appeared!")).toEqual(25); -// }); - -// test("multiply multiplies numbers", () => { -// expect(multiply(2, 3, 6)).toEqual(36); -// }); - -// test("multiply multiplies different numbers", () => { -// expect(multiply(2, 3, 4)).toEqual(24); -// }); +test("trimWord trims leading and trailing whitespace", () => { + expect(trimWord(" CodeYourFuture ")).toEqual("CodeYourFuture"); +}); + +test("trimWord doesn't remove whitespace in the middle of the string", () => { + expect(trimWord(" CodeYourFuture teaches coding ")).toEqual( + "CodeYourFuture teaches coding" + ); +}); + +test("getStringLength returns the length of a word", () => { + expect(getStringLength("Turtles")).toEqual(7); +}); + +test("getStringLength returns the length of a sentence", () => { + expect(getStringLength("A wild sentence appeared!")).toEqual(25); +}); + +test("multiply multiplies numbers", () => { + expect(multiply(2, 3, 6)).toEqual(36); +}); + +test("multiply multiplies different numbers", () => { + expect(multiply(2, 3, 4)).toEqual(24); +}); diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index 07fe1e651..5c1ff0c1a 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -36,26 +36,26 @@ To run the tests for just this one file, type `npm test -- --testPathPattern 4-t =================================================== */ -// test("calculateSalesTax for £15", () => { -// expect(calculateSalesTax(15)).toEqual(18); -// }); +test("calculateSalesTax for £15", () => { + expect(calculateSalesTax(15)).toEqual(18); +}); -// test("calculateSalesTax for £17.50", () => { -// expect(calculateSalesTax(17.5)).toEqual(21); -// }); +test("calculateSalesTax for £17.50", () => { + expect(calculateSalesTax(17.5)).toEqual(21); +}); -// test("calculateSalesTax for £34", () => { -// expect(calculateSalesTax(34)).toEqual(40.8); -// }); +test("calculateSalesTax for £34", () => { + expect(calculateSalesTax(34)).toEqual(40.8); +}); -// test("addTaxAndFormatCurrency for £15", () => { -// expect(addTaxAndFormatCurrency(15)).toEqual("£18.00"); -// }); +test("addTaxAndFormatCurrency for £15", () => { + expect(addTaxAndFormatCurrency(15)).toEqual("£18.00"); +}); -// test("addTaxAndFormatCurrency for £17.50", () => { -// expect(addTaxAndFormatCurrency(17.5)).toEqual("£21.00"); -// }); +test("addTaxAndFormatCurrency for £17.50", () => { + expect(addTaxAndFormatCurrency(17.5)).toEqual("£21.00"); +}); -// test("addTaxAndFormatCurrency for £34", () => { -// expect(addTaxAndFormatCurrency(34)).toEqual("£40.80"); -// }); +test("addTaxAndFormatCurrency for £34", () => { + expect(addTaxAndFormatCurrency(34)).toEqual("£40.80"); +}); From 0f19df6d382d1cffb263ea7b3137cbc7226dc947 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 21:38:48 +0100 Subject: [PATCH 16/28] Remove console .log --- mandatory/4-tax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index 5c1ff0c1a..859bea314 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -8,7 +8,7 @@ function calculateSalesTax(product) { return product / 100 * 20; } -console.log(calculateSalesTax(100)); + /* CURRENCY FORMATTING @@ -23,7 +23,7 @@ console.log(calculateSalesTax(100)); function addTaxAndFormatCurrency(a) { return sum = a.toFixed(2); } -console.log(addTaxAndFormatCurrency(calculateSalesTax(100))); +console.log(addTaxAndFormatCurrency(calculateSalesTax(30))); /* =================================================== From 016515dcd9b25f9dc225180b41aea82c1aa9e697 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 21:42:41 +0100 Subject: [PATCH 17/28] =?UTF-8?q?Add=20=C2=A3=20sign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mandatory/4-tax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index 859bea314..5ded8533a 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -23,7 +23,7 @@ function calculateSalesTax(product) { function addTaxAndFormatCurrency(a) { return sum = a.toFixed(2); } -console.log(addTaxAndFormatCurrency(calculateSalesTax(30))); +console.log("£" + addTaxAndFormatCurrency(calculateSalesTax(30))); /* =================================================== From 85f27c6dcf9a8367c6b170f497b8b4f3f29e0803 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 21:51:43 +0100 Subject: [PATCH 18/28] Correct the wrong word --- mandatory/3-function-output.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index 324736878..e836900df 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -9,7 +9,7 @@ function combine2Words(word1, word2) { } function concatenate(firstWord, secondWord, thirdWord) { - return "I" + " " + "am" + " " + 13; + return "I" + " " + "like" + " " + "pizza"; // Write the body of this function to concatenate three words together. From 68c4c0ba337ac09476e21dbe2036929029c06b0c Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Tue, 23 Aug 2022 22:02:05 +0100 Subject: [PATCH 19/28] correct the mistake --- mandatory/2-logic-error.js | 3 ++- mandatory/4-tax.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index f0b8af2db..aed4aa044 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -1,7 +1,8 @@ // The syntax for this function is valid but it has an error, find it and fix it. function trimWord(word) { - return "CodeYourFuture" ; + return word.trim() ; + } console.log(trimWord()); diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index 5ded8533a..bcbe6e27d 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -23,7 +23,7 @@ function calculateSalesTax(product) { function addTaxAndFormatCurrency(a) { return sum = a.toFixed(2); } -console.log("£" + addTaxAndFormatCurrency(calculateSalesTax(30))); +console.log("£" + addTaxAndFormatCurrency(calculateSalesTax(34))); /* =================================================== From f356574f5a7a170549defee1b41402d935c13c8f Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 07:34:33 +0100 Subject: [PATCH 20/28] Fix push problem --- mandatory/3-function-output.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index e836900df..2982cc99d 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -9,8 +9,9 @@ function combine2Words(word1, word2) { } function concatenate(firstWord, secondWord, thirdWord) { - return "I" + " " + "like" + " " + "pizza"; - + firstWord = "I"; + return firstWord.concat() + " " + "like " + "pizza"; + // 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. From 347d720df509213eac988d3033b63873566419a2 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 07:58:28 +0100 Subject: [PATCH 21/28] fix the problem of mandatory\3 --- mandatory/3-function-output.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index 2982cc99d..013925202 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -10,7 +10,9 @@ function combine2Words(word1, word2) { function concatenate(firstWord, secondWord, thirdWord) { firstWord = "I"; - return firstWord.concat() + " " + "like " + "pizza"; + secondWord = "like"; + thirdWord = "pizza"; + return firstWord + " " + secondWord + " " + thirdWord; // Write the body of this function to concatenate three words together. From d66fd4c0647b3123aa4b1ebf273eba654739f14c Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 08:02:23 +0100 Subject: [PATCH 22/28] Fix the problem of mandatory\2 --- mandatory/2-logic-error.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index aed4aa044..f9e63d806 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -1,13 +1,13 @@ // The syntax for this function is valid but it has an error, find it and fix it. function trimWord(word) { - return word.trim() ; + return word = word.trim() ; } console.log(trimWord()); function getStringLength(word) { - return word.length; + return word = word.length; } console.log(getStringLength("Hello World")); From 9758467e09387bb2175834ef8201e82995b27ee4 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 08:09:51 +0100 Subject: [PATCH 23/28] Fix mandatory\2 --- mandatory/2-logic-error.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index f9e63d806..78e99bbda 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -1,21 +1,19 @@ // The syntax for this function is valid but it has an error, find it and fix it. function trimWord(word) { - return word = word.trim() ; + return word.trim(); } -console.log(trimWord()); + function getStringLength(word) { - return word = word.length; + return word.length; } -console.log(getStringLength("Hello World")); function multiply(a, b, c) { return a * b * c; } -console.log(multiply(2,3,6)); /* =================================================== ======= TESTS - DO NOT MODIFY BELOW THIS LINE ===== From dc16d51a3092da1eadaa5ea326d3bd6a57086aed Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 08:27:00 +0100 Subject: [PATCH 24/28] try to fix the problem --- mandatory/3-function-output.js | 6 +----- mandatory/4-tax.js | 7 ++++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index 013925202..d8649b92b 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -9,16 +9,12 @@ function combine2Words(word1, word2) { } function concatenate(firstWord, secondWord, thirdWord) { - firstWord = "I"; - secondWord = "like"; - thirdWord = "pizza"; - return firstWord + " " + secondWord + " " + thirdWord; + return firstWord.concat(" ", 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. } -console.log(concatenate()); /* =================================================== diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index bcbe6e27d..b26cdb77d 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -6,7 +6,8 @@ */ function calculateSalesTax(product) { - return product / 100 * 20; + let tex = product / 100 * 20; + return tax } @@ -21,9 +22,9 @@ function calculateSalesTax(product) { */ function addTaxAndFormatCurrency(a) { - return sum = a.toFixed(2); + return "£" + calculateSalesTax(a).toFixed(2); } -console.log("£" + addTaxAndFormatCurrency(calculateSalesTax(34))); +// console.log( addTaxAndFormatCurrency(calculateSalesTax(34))); /* =================================================== From 032f484fc4ae2338d5116b5e470b0807f1ff86cd Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 08:31:42 +0100 Subject: [PATCH 25/28] Fix the problem --- mandatory/4-tax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index b26cdb77d..6ee11a25a 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -6,8 +6,8 @@ */ function calculateSalesTax(product) { - let tex = product / 100 * 20; - return tax + let tex = (product / 100) * 20 + product; + return tax; } From c193fa4a92a15153774f27f588b58e68f1f47b91 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 08:35:34 +0100 Subject: [PATCH 26/28] Fix submitting --- mandatory/4-tax.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index 6ee11a25a..a01c8ad0e 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -6,11 +6,13 @@ */ function calculateSalesTax(product) { - let tex = (product / 100) * 20 + product; - return tax; + let product1 = (product1 * 20) / 100 + product; +return product1; + } + /* CURRENCY FORMATTING =================== From 8bdec3c4ac5769ccbea004178c3ddaa4bdd05827 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 08:37:25 +0100 Subject: [PATCH 27/28] Fix the submitting --- mandatory/4-tax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index a01c8ad0e..39f579685 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -6,7 +6,7 @@ */ function calculateSalesTax(product) { - let product1 = (product1 * 20) / 100 + product; + let product1 = (product * 20) / 100 + product; return product1; } From dfcec4c6eaf48e31abb8d5f808b04a9807a0ddf6 Mon Sep 17 00:00:00 2001 From: Danti_86 Date: Wed, 24 Aug 2022 19:23:40 +0100 Subject: [PATCH 28/28] change some review from colleague. --- exercises/I-floats/exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index 7a2085ccd..368dbc29f 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -3,4 +3,4 @@ var preciseAge = 30.612437; var result = preciseAge / 10; var resultWhole = Math.round(result); -console.log(resultWhole + "%"); \ No newline at end of file +console.log(resultWhole + ": " + "%"); \ No newline at end of file