File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,8 +2,14 @@ const minimum = 1;
22const maximum = 100 ;
33
44const num = Math . floor ( Math . random ( ) * ( maximum - minimum + 1 ) ) + minimum ;
5+ console . log ( num ) ;
56
67// In this exercise, you will need to work out what num represents?
78// Try breaking down the expression and using documentation to explain what it means
89// It will help to think about the order in which expressions are evaluated
910// Try logging the value of num and running the program several times to build an idea of what the program is doing
11+
12+ // From what I can work out, it is generations a random number between 2 and 100 for the value of num.
13+ // math.floor ensures the number is a whole number without decibils. (maximum - minimu +1) is (100 - 1 + 1)=100.
14+ // Math.random pics a random number from 0 to 1 with two decibils, such as 2.13.
15+ // The Order they follow is: Match.random multiplied by (Maximum - minimum + 1), then add minimum of 1.
You can’t perform that action at this time.
0 commit comments