London10 - Khalil Alhaydr - JavaScript-core1-courswork-week1 - #493
London10 - Khalil Alhaydr - JavaScript-core1-courswork-week1#493Khlil1313 wants to merge 6 commits into
Conversation
|
|
||
| function getStringLength(word) { | ||
| return "word".length(); | ||
| return word.length(); |
There was a problem hiding this comment.
Hi Khalil. The length property does not need parentheses.
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(price) { | ||
| return price + price*0.2; |
There was a problem hiding this comment.
Minor things to suggest. Please keep spacing consistent.You did it for +, but * needs space.
I had the same problem like you for considering spaces
| // 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) { |
There was a problem hiding this comment.
Comment: On these first three code assignments we have the same solution
| a * b * c; | ||
| return; | ||
| total = a * b * c; | ||
| return total; |
There was a problem hiding this comment.
Consider: function multiply(a, b, c) {
const answer = a * b * c;
return answer;
}
| // this function return a random number between 0 and 100. | ||
| function getRandomNumber() { | ||
| return Math.random() * 10; | ||
| } |
| // the concat() method join 2 strings together. | ||
| function combine2Words(word1, word2) { | ||
| return word1.concat(word2); | ||
| } |
| // 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(price) { | ||
| return price + price*0.2; |
There was a problem hiding this comment.
Change to this option?
function calculateSalesTax(sales) {
let tax = sales * 0.2;
let total = sales + tax;
return total;
}
|
|
||
| } | ||
| console.log(addTaxAndFormatCurrency(40)) | ||
|
|
There was a problem hiding this comment.
Consider this option. function addTaxAndFormatCurrency(sales) {
return "£" + calculateSalesTax(sales).toFixed(2);
}
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?