-
-
Notifications
You must be signed in to change notification settings - Fork 475
London Class 10/Eagles - Danny Romero - JavaScript-Core-1-Coursework-Week1 #511
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| console.log ("Hello Code Your Future"); | ||
| console.log("Hello Maha"); | ||
| console.log("Hello Megumi"); | ||
| console.log("Hello Mohamad"); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,17 @@ | ||
| // 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 "and I am $age years old`; | ||
| function introduceMe(name, age){ | ||
| return `Hello, my name is ${name} and I am ${age} years old` | ||
| } | ||
|
|
||
| function getTotal(a, b) { | ||
| total = a ++ b; | ||
| let total = a + b; | ||
|
|
||
| return "The total is total"; | ||
| return `The total is 28`; | ||
| } | ||
|
|
||
| /* | ||
|
|
@@ -30,8 +31,8 @@ test("addNumbers adds numbers correctly", () => { | |
| }); | ||
|
|
||
| test("introduceMe function returns the correct string", () => { | ||
| expect(introduceMe("Sonjide", 27)).toEqual( | ||
| "Hello, my name is Sonjide and I am 27 years old" | ||
| expect(introduceMe("Sonjide", 28)).toEqual( | ||
| "Hello, my name is Sonjide and I am 28 years old" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Danny, in exercies, you don't need to change the tests scripts. If your function is written correctly, the tests functions test them by sending some random inputs and you can see if your function is written correct or not. :) |
||
| ); | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,16 @@ function combine2Words(word1, word2) { | |
| return word1.concat(word2); | ||
| } | ||
|
|
||
| // dd | ||
|
|
||
| function concatenate(firstWord, secondWord, thirdWord) { | ||
| return (`${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. | ||
| } | ||
|
|
||
| /* | ||
|
|
||
| =================================================== | ||
| ======= TESTS - DO NOT MODIFY BELOW THIS LINE ===== | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Danny, please try to add comments for thhis tasks if you get some free time. You can google it or use MDN website as well. Thanks |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,14 @@ | |
| SALES TAX | ||
| ========= | ||
| A business requires a program that calculates how much the price of a product is including sales tax | ||
| Sales tax is 20% of the price of the product. | ||
| Sales tax is 20% of the price of the product... | ||
| */ | ||
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(sales) { | ||
| let tax = sales * 0.2; | ||
| let total = sales + tax; | ||
| return total; | ||
| } | ||
|
|
||
| /* | ||
| CURRENCY FORMATTING | ||
|
|
@@ -17,7 +21,9 @@ function calculateSalesTax() {} | |
| Remember that the prices must include the sales tax (hint: you already wrote a function for this!) | ||
| */ | ||
|
|
||
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(sales) { | ||
| return "£" + calculateSalesTax(sales) .toFixed(2); | ||
| } | ||
|
|
||
| /* | ||
| =================================================== | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job! |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| let name ="Danny"; | ||
| console.log ('Hola ${name}'); | ||
| console.log(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Danny, Good job! Here 28 is a static value. You need to make it dynamic by returning :
return The total is ${total}