Glasgow Class 6 Melese Berehannu js-1 week1#518
Glasgow Class 6 Melese Berehannu js-1 week1#518Melesegithub wants to merge 1 commit intoCodeYourFuture:masterfrom
Conversation
munozirianni1988
left a comment
There was a problem hiding this comment.
Hi Melese, great job! Everything looks good. Just a wee suggestions, if you put a semicolon (;) at the ned of your return statement, I don't think you need parenthesis on it.
malkitbenning
left a comment
There was a problem hiding this comment.
Overall excellent - you have shown that you know how to code this level of JavaScript and how to debug. There are a few minor corrections in my review. Overall please note Jest generates its own tests so you don't need add your own.
| total = (a + b); | ||
|
|
||
| return "The total is total"; | ||
| return ('The total is ' + total); |
There was a problem hiding this comment.
Your changes will work, but another way would have been to include the total inside the string -
return (The total is ${total});
There was a problem hiding this comment.
Don't forget the backticks though.
return `The total is ${total}`;
| return "The total is total"; | ||
| return ('The total is ' + total); | ||
| } | ||
| addNumbers(3,4,6); |
There was a problem hiding this comment.
You don't need to add your own tests as the Jest will run it's own tests.
| getStringLength("Turtles"); | ||
| getStringLength("A wild sentence appeared!"); | ||
| multiply(2, 3, 6); | ||
| multiply(2, 3, 4); |
There was a problem hiding this comment.
No need to add your own tests - the system will do it's own tests.
| @@ -1,18 +1,23 @@ | |||
| // Add comments to explain what this function does. You're meant to use Google! | |||
| //This getRandomNumber function let you to get a random number greater than 0 and less than 10. | |||
There was a problem hiding this comment.
Well done on adding a comment here - many students missed this.
| 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.concat(secondWord, thirdWord); |
| */ | ||
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(product) { |
There was a problem hiding this comment.
Did this work? It looks like you are adding the tax to the original amount, but this should only be working out the tax. You should be adding the tax to the original amount later in the code.
There was a problem hiding this comment.
Apologies Melese - you were right in the first place! You are supposed to calculate the full amount here - rather than just tax. I misunderstood the requirement.
| return "£"+(Math.round(calculateSalesTax(product)).toFixed(2)) | ||
|
|
||
| } | ||
| calculateSalesTax(15); |
There was a problem hiding this comment.
no need to include your own tests - the system generates its own tests.
|
|
||
| function trimWord(word) { | ||
| return wordtrim(); | ||
| return (word.trim()); |
There was a problem hiding this comment.
No need for the extra brackets here,
return word.trim();
is enough.
|
|
||
| function getStringLength(word) { | ||
| return "word".length(); | ||
| return (word.length); |
There was a problem hiding this comment.
Same here, word.length without brackets is enough.
js-1-week1
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?