File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,15 @@ 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+
11+
12+ /*
13+ num stores a random integer between minimum (1) and maximum (100), inclusive.
14+
15+ Breakdown:
16+ 1. Math.random() generates a decimal number between 0 (inclusive) and 1 (exclusive).
17+ 2. Multiplying by (maximum - minimum + 1) scales the range to 0–100.
18+ 3. Math.floor() removes the decimal part, producing integers from 0–99.
19+ 4. Adding minimum shifts the range to 1–100.
20+ */
21+ console . log ( num ) ;
You can’t perform that action at this time.
0 commit comments