London | 26-ITP-May | Anita Amirhaeri | Sprint 1 | Structuring-and-Testing-Data - #1566
London | 26-ITP-May | Anita Amirhaeri | Sprint 1 | Structuring-and-Testing-Data#1566anitahy73 wants to merge 8 commits into
Conversation
Added a comment explaining the increment operation on the count variable.
Updated the initials variable to dynamically extract the first characters from firstName, middleName, and lastName.
Log the randomly generated number to the console.
Added comments to provide instructions for the first activity.
Added comments to explain variable declarations and expressions.
Added comments to explain variable usage and code functionality.
Added comments explaining the purpose of each step in the code.
cjyuan
left a comment
There was a problem hiding this comment.
You missed updating 4 files in Sprint-1/2-mandatory-errors.
| console.log (num); | ||
| // In this exercise, you will need to work out what num represents? | ||
| // Try breaking down the expression and using documentation to explain what it means | ||
| // It will help to think about the order in which expressions are evaluated | ||
| // Try logging the value of num and running the program several times to build an idea of what the program is doing |
There was a problem hiding this comment.
Could you give a precise description what each of these expressions does, and the range of the numbers it may produce?
Math.random()Math.random() * (maximum - minimum + 1)Math.floor(Math.random() * (maximum - minimum + 1))Math.floor(Math.random() * (maximum - minimum + 1)) + minimum
Note: To describe a range of numbers, we could use the concise and precise interval notation:
[,]=> inclusion(,)=> exclusion
For example,
$x$ is a number between 1 and 10, including 1 but excluding 10.
| a) There are 5 calls made: | ||
| carPrice = Number(carPrice.replaceAll(",", "")); | ||
| priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")) | ||
| b) Error on line 5 for "," it is missing the seperating , between "," and "". |
There was a problem hiding this comment.
We could also say, "a comma is omitted between the ___________s."
What is the programming term that refers to the values (e.g., "," and "") passed to a function? It begins with an 'a'.
| c) It is taking the movieLength and doing a remainder that is showing what is left after the vaule has been divided, in this case wil be 84. | ||
| I found the info here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder | ||
| d) It is removing any extra seconds from the division by 60 so that is is showing as whole numbers without decimals. | ||
| e) Result is showing the movies duration but broken down to hours:minutes:seconds, I think it should be movieDuration to help describe it better. |
There was a problem hiding this comment.
The name movieDuration does not quite indicate the value stored in the variable
is a formatted string in the form "2:12:02".
Could you suggest a more descriptive name?
Learners, PR Template
Self checklist
Changelist
Sprint 1 tasks
Questions