File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -8,5 +8,14 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
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
1010
11+ //num represents the results of equations at the right side of operator =
12+
13+ //step-1---> Math.random() generates a random decimal.
14+ //step-2---> (maximum - minimum + 1) evaluates to 100.
15+ //step-3---> Math.random() is multiplied by (maximum - minimum + 1) which is 100, resulting in a random decimal between 0 and 100.
16+ //step-4---> the result of Step-3 is round by the method Math.floor.
17+ //step-5---> minimum is added to the result of step-4.
18+ //Therefore, num represents random numbers generated between minimum 1 and maximum 100, as we run the code several times
19+ //generates new numbers.
1120
1221console . log ( num ) ;
You can’t perform that action at this time.
0 commit comments