London Class 7 - Benyam Worku - Javascript-Core - Week 1#71
London Class 7 - Benyam Worku - Javascript-Core - Week 1#71BenyamWorku wants to merge 5 commits into
Conversation
|
Hi Benyam, You have done a great job as far as I check, everything looks good. I suggest that may some comments will give make your code more readable and make it easier to understand. |
Thanks Ahmad I have now added some more comments. |
| let afterTax = prices + calculateSalesTax(prices); | ||
| return `£${afterTax}` | ||
| } |
There was a problem hiding this comment.
you might need to use .toFixed(2) to force it to give two decimals
There was a problem hiding this comment.
Yeah that is a good idea. But , this passed the test too. I guess it is because we've multiplied it by 0.2 . I will look into it. Thanks !
amellie
left a comment
There was a problem hiding this comment.
Very well done on your effort, Ben! If you could please correct some of the comments I have for you? :)
| } | ||
|
|
||
| function concatenate(firstWord, secondWord, thirdWord) { | ||
| return firstWord + " ".concat(secondWord) + " ".concat(thirdWord); |
There was a problem hiding this comment.
This works perfectly well, but I would advise you to use one method of concatenating. In this line, you use both the plus sign + and the concat method. Since both methods are the same, it is always advised to use the plus sign as it is easier to read. Can you please change this line of code to reflect this?
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(prices) { | ||
| return 0.2 * prices; |
There was a problem hiding this comment.
It seems that the test has failed. Would you be able to fix this?
There was a problem hiding this comment.
Has it ? It passed on my machine . I will apply toFixed(2)
| */ | ||
| function checkAnswer(answer) { | ||
| //Write your code in here | ||
| for (const group of Object.keys(magicAnswer)) |
There was a problem hiding this comment.
Just a small note here. Please ensure that the indentation is correctly done (especially the brackets). It should be:
for(...) {
//code here
}
There was a problem hiding this comment.
Prettier has been working fine . I will have a look. Thanks !
There was a problem hiding this comment.
You can refer to https://syllabus.codeyourfuture.io/guides/code-style-guide
|
|
||
| // Add comments to explain what this function does. You're meant to use Google! | ||
| function s(w1, w2) { | ||
| // stringing together two strings-no spaces- and returns a string |
There was a problem hiding this comment.
A better way of commenting is: join two strings with no spaces
|
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. |
Your Details
Homework Details