London | 26-ITP-May | Damilola Odumosu | Sprint 2 | Coursework#1465
London | 26-ITP-May | Damilola Odumosu | Sprint 2 | Coursework#1465d-odumosu wants to merge 12 commits into
Conversation
| function capitalise(str){ | ||
| str = `${str[0].toUpperCase()}${str.slice(0)}`; | ||
| return str | ||
| } |
There was a problem hiding this comment.
Generally we reassign the value of a variable if we want to update the value whilst the recognising that what the value represents has stayed the same. Here, you're reassigning str to be something that represents a different thing. Considering this, can you think of an alternative approach to reassigning the existing str variable that would make this a little bit more readable?
| /* - The function will throw a syntax error because we have redeclared the parameter variable "decimalNumber", and we have | ||
| also used const for declaring percentage, percentage will change when we call the function with different arguments so it should | ||
| be declared using let. | ||
| - we are console logging the variable decimalNumber outside the function - the variable lives only inside the function | ||
| */ |
There was a problem hiding this comment.
we have also used const for declaring percentage, percentage will change when we call the function with different arguments so it should be declared using let
What exactly is the difference between const and let? Does it or does it not have an impact in this function?
|
Great work overall, just a couple of small comments! |
Self checklist
Changelist
completed all mandatory and stretch