File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,9 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77// Try breaking down the expression and using documentation to explain what it means
88// It will help to think about the order in which expressions are evaluated
99// Try logging the value of num and running the program several times to build an idea of what the program is doing
10+ console . log ( num ) ;
11+ // num is a random integer between 1 and 100.
12+ // Math.random() generates a random floating-point number between 0 and 1.
13+ // Multiplying this by (maximum - minimum + 1) scales it to a range of 0 to 100.
14+ // Math.floor() rounds down the result to the nearest integer number.
15+ // Finally, adding minimum shifts the range to be between 1 and 100.
You can’t perform that action at this time.
0 commit comments