SOUTH_AFRICA - ERICK MULINDI - JAVASCRIPT_CORE_1 - WEEK_6 - #50
SOUTH_AFRICA - ERICK MULINDI - JAVASCRIPT_CORE_1 - WEEK_6#50mulindierick wants to merge 1 commit into
Conversation
finished the mandatory and exercise Javascript home
|
|
||
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(price) { | ||
| return "£" + parseFloat(calculateSalesTax(price)).toFixed(2); |
There was a problem hiding this comment.
Good coding there. Use of parseFloat to avoid TypeError when applying the "toFixed" method
| */ | ||
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(price, item) { |
There was a problem hiding this comment.
The second parameter "item" is never used
There was a problem hiding this comment.
Ohh yeah, I forgot to delete that
| @@ -1,14 +1,17 @@ | |||
| // Add comments to explain what this function does. You're meant to use Google! | |||
| // return a radom number between 1 and 10 | |||
There was a problem hiding this comment.
yes, thanks again... surprising how it's hard to detect some of these things
| } | ||
|
|
||
| function concatenate(firstWord, secondWord, thirdWord) { | ||
| return firstWord.concat(" "+secondWord + " ", thirdWord); |
There was a problem hiding this comment.
Hey great work just some refactoring tip here...
- return firstWord.concar(" "+secondWord + " ", thirdWord);
+ return `${firstWord} ${secondWord}, ${thirdWord}`;- So your solution there works but prone to errors that can be caused by mistake you can miss on spacing your quotation marks then the words get attached together as one word which is something you did not intend to do
- So template literals tend to be the most effective in concatenating strings etc
ezekiel444
left a comment
There was a problem hiding this comment.
Nice work Erick. As time goes on try to use more of 'Template literals' for readability. 👍
ezekiel444
left a comment
There was a problem hiding this comment.
F-string-method-- exercise 2: you should check the length of nameTrim not the name containing the extra spaces.
extra exercise is untouched
mandatoy-4-tax: second parameter is not used.
| const name = " Daniel "; | ||
| var firstName = " Daniel "; | ||
| var nameTrim = firstName.trim(); | ||
| var firstNameLength = firstName.length; |
There was a problem hiding this comment.
you should check the length of nameTrim not the name containing the extra spaces.
| var firstNameLength = firstName.length; | ||
| var message = "My name is " + nameTrim + " and my name is " + firstNameLength + " characters long." | ||
|
|
||
| console.log(message); |
There was a problem hiding this comment.
this code did not meet the requirement because you're getting the wrong name length
| */ | ||
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(price, item) { |
ezekiel444
left a comment
There was a problem hiding this comment.
F-string-method-- exercise 2: you should check the length of nameTrim not the name containing the extra spaces.
extra exercise is untouched
mandatoy-4-tax: second parameter is not used.
|
Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback. |
finished the mandatory and exercise Javascript home
Your Details
Homework Details