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 10 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.
| 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?
There was a problem hiding this comment.
I can suggest movieFullDuration
There was a problem hiding this comment.
Ideally the name could suggest the value is a string (and not a number). For example, add a "formatted" prefix or "Str" suffix.
Added detailed comments explaining the random number generation process.
cjyuan
left a comment
There was a problem hiding this comment.
Changes look good. Well done.
| // Math.random() : Generates a pseudorandom decimal number. [0, 1) | ||
| // Math.random() * (maximum - minimum + 1) : Scales the random value so its width equals the number of integers from `minimum` to `maximum`. [0, maximum - minimum + 1) | ||
| // Math.floor(Math.random() * (maximum - minimum + 1)) : Floors the scaled value, producing a random integer starting at 0. Integers in [0, maximum - minimum + 1), i.e. {0, 1, ..., maximum - minimum} | ||
| // Math.floor(Math.random() * (maximum - minimum + 1)) + minimum` : Shifts the previous result upward by `minimum`, producing a random integer between `minimum` and `maximum`, inclusive. Integers in [minimum, maximum + 1), i.e. {minimum, minimum + 1, ..., maximum} |
There was a problem hiding this comment.
Note: For integers, [minimum, maximum + 1) could also be expressed as [minimum, maximum].
|
Closing PR because the May ITP run has finished. Feel free to re-open if you're still working on it. |
Learners, PR Template
Self checklist
Changelist
Sprint 1 tasks
Questions