-
-
Notifications
You must be signed in to change notification settings - Fork 481
london_10-Saliha_Popal-JavaScript-Core-1-Coursework-Week1 #540
base: master
Are you sure you want to change the base?
Conversation
@@ -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; | |||
} |
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.
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.
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.
Good work Saliha. 👍
@@ -1,16 +1,15 @@ | |||
// The syntax for these functions is valid but there are some errors, find them and fix them | |||
|
|||
function trimWord(word) { | |||
return wordtrim(); | |||
return word.trim(); | |||
} |
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.
Comment: Looks good and same answers as me on all three.
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.
Good work Saliha. 👍
} | ||
|
||
// 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. |
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.
Comment: Good description.
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.
Good work Saliha. 👍
} | ||
|
||
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,); | ||
} |
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.
Comment: same answer as me.
|
||
function format(value) { | ||
let currency = "£" | ||
return "£" + value; | ||
} | ||
|
||
const startingValue = 2; | ||
|
||
// Why can this code be seen as bad practice? Comment your answer. |
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.
Question: have we answered the question here
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: nice converting them all to arrays of strings
|
||
return "The total is total"; | ||
return `The total is ${total}`; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Math.round(priceInBRL * 100) / 100; is used in
JavaScript-Core-1-Coursework-Week1-Solution
|
||
function format(value) { | ||
let currency = "£" | ||
return "£" + value; | ||
} | ||
|
||
const startingValue = 2; | ||
|
||
// Why can this code be seen as bad practice? Comment your answer. |
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.
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.md
in 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?