london_10-Saliha_Popal-JavaScript-Core-1-Coursework-Week1#540
london_10-Saliha_Popal-JavaScript-Core-1-Coursework-Week1#540SalihaPopal wants to merge 1 commit intoCodeYourFuture:masterfrom
Conversation
| function addNumbers(a b c) { | ||
| function addNumbers(a, b, c) { | ||
| return a + b + c; | ||
| } |
There was a problem hiding this comment.
Comment: Well done! Same as answers as me.
Consider: It makes no difference in the outcome. Sometimes you have space in between curly brackets and sometimes not. I do the same.
| function trimWord(word) { | ||
| return wordtrim(); | ||
| return word.trim(); | ||
| } |
There was a problem hiding this comment.
Comment: Looks good and same answers as me on all three.
| // Add comments to explain what this function does. You're meant to use Google! | ||
| function combine2Words(word1, word2) { | ||
| return word1.concat(word2); | ||
| // this function combine two strings and make a new string. |
| // 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,); | ||
| } |
|
|
||
| const startingValue = 2; | ||
|
|
||
| // Why can this code be seen as bad practice? Comment your answer. |
There was a problem hiding this comment.
Question: have we answered the question here
There was a problem hiding this comment.
If the starting value is not a number, the code may return an error.
If the add (10) or multiply (2) in functions are not defined , the code may not produce the correct result.
If the format function is not defined or doesn't behave as expected, the code may not produce the desired string representation of the result.
| Outlook not so good. | ||
| Very doubtful. | ||
| */ | ||
| **/ |
There was a problem hiding this comment.
praise: nice converting them all to arrays of strings
| total = a + b; | ||
|
|
||
| return "The total is total"; | ||
| return `The total is ${total}`; |
There was a problem hiding this comment.
praise: Nice use of template literals here
| function convertToBRL() {} | ||
| function convertToBRL(amount) { | ||
| let rate = 5.7; | ||
| return parseFloat((amount * 5.7 * 0.99).toFixed(2)); |
There was a problem hiding this comment.
Math.round(priceInBRL * 100) / 100; is used in
JavaScript-Core-1-Coursework-Week1-Solution
|
|
||
| const startingValue = 2; | ||
|
|
||
| // Why can this code be seen as bad practice? Comment your answer. |
There was a problem hiding this comment.
If the starting value is not a number, the code may return an error.
If the add (10) or multiply (2) in functions are not defined , the code may not produce the correct result.
If the format function is not defined or doesn't behave as expected, the code may not produce the desired string representation of the result.
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?