File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ const maximum = 100;
44const num = Math . floor ( Math . random ( ) * ( maximum - minimum + 1 ) ) + minimum ;
55
66// In this exercise, you will need to work out what num represents?
7+ //num represents a variable with the a random number as its value
8+
79// Try breaking down the expression and using documentation to explain what it means
10+ //Math.random() returns a pseudo random number that's >=0 and <1
11+ //Math.floor() rounds down to the nearest integer
12+
813// It will help to think about the order in which expressions are evaluated
14+ //this first (maximum-minimum+1) then this Math.random()* then this Math.floor() then this +minimum
15+
916// Try logging the value of num and running the program several times to build an idea of what the program is doing
17+ //it returns a pseudo random number that's >=0 and <1
18+
19+
20+ console . log ( num ) ;
You can’t perform that action at this time.
0 commit comments