File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,20 @@ const maximum = 100;
55// console.log(num);
66
77
8- // Math.floor() takes the integer Number
9- // Math.random() will take a number between 1-100;
10-
11-
12-
138// In this exercise, you will need to work out what num represents?
149// Try breaking down the expression and using documentation to explain what it means
1510// It will help to think about the order in which expressions are evaluated
1611// Try logging the value of num and running the program several times to build an idea of what the program is doing
1712
13+ / * M a t h .f l o o r ( ) t a k e s t h e i n t e g e r N u m b e r
14+ Math . random ( ) will take a number between 0 ( inclusive ) and 1 ( no inclusive ) eg . ( 0.345 , 0 , 123 )
15+ Math . random ( ) * ( maximum - minimum + 1 ) : this multiply the random decimal number
16+
17+
18+
19+
1820
21+ // in this example taken from mdn we see the same function being called and will generate a random number between the minimun and maximun
1922
2023function getRandomArbitrary ( min , max ) {
2124 return Math . random ( ) * ( max - min ) + min ;
You can’t perform that action at this time.
0 commit comments