London Class 8 - Irina Shilova - JavaScript - Core 1 - Week 1 - #258
London Class 8 - Irina Shilova - JavaScript - Core 1 - Week 1 #258IrinShilova wants to merge 3 commits into
Conversation
|
|
||
| let message = "My name is " + name + " and my name is 6 characters long." | ||
| console.log(message); | ||
| var nameTrim = name.trim(); |
There was a problem hiding this comment.
Great work just one thing, it may be better to use let or const instead of var here.
There was a problem hiding this comment.
Great work just one thing, it may be better to use let or const instead of var here.
Yes, I agree. Thank you, Hamra
| return "Hello, my name is " + name "and I am " age + "years old"; | ||
|
|
||
| function introduceMe(name, age) { | ||
| return "Hello, my name is " + name + " and I am " + age + "years old"; |
There was a problem hiding this comment.
Looks like you have a minor bug here, just missing a space before "years old". Also, this may be a nice place to try out string interpolation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
| return word.length(); | ||
| } | ||
|
|
||
| function multiply(a, b, c) { |
There was a problem hiding this comment.
Did you get a chance to look at this multiply function? It looks like you will still need to return a value here.
| function calculateSalesTax() {} | ||
| function calculateSalesTax(num) { | ||
| let tax = (num * 20) / 100; | ||
| return tax + num; |
|
|
||
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(num) { | ||
| return "£" + calculateSalesTax(num).toFixed(2); |
There was a problem hiding this comment.
Really well done on this tax exercise!
| function convertToBRL() {} | ||
| function convertToBRL(price) { | ||
| let newPrice = ((price * 99) / 100) * 5.7; | ||
| let brazilPrice = newPrice.toFixed(2); |
There was a problem hiding this comment.
Looks like the tests are failing here because this function is not returning a value. Any idea how you might fix this?
| // Why can this code be seen as bad practice? Comment your answer. | ||
| let badCode = | ||
| // too many functions, difficult to understand; | ||
| format (multiply(add(startingValue, 10), 2)); |
There was a problem hiding this comment.
Looks like the test is failing because we're not assigning a value to the variable badCode. Can you think of how to fix this?
|
Hey @IrinShilova, overall this is a good effort - well done! It looks like you had some failing tests in your exercises. Were you able to get the tests running in your local environment? If you need help with that, please let me know! |
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? First exercises
What did you find hard? Some functions
What do you still not understand? The last task in "extra"
Any other notes?