You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// In this exercise, you will need to work out what num represents?
7
8
// Try breaking down the expression and using documentation to explain what it means
8
9
// It will help to think about the order in which expressions are evaluated
9
10
// Try logging the value of num and running the program several times to build an idea of what the program is doing
11
+
12
+
// Math.random() returns a random decimal number between 0 and 1
13
+
// (maximum - minimum + 1) represents the size of range of numbers we want to include. We add +1 because both minim and maximum are included in the range
14
+
// Math.random() * (maximum - minimum + 1) gives us a random decimal between 0 and 100, but still decimal
15
+
// Math.floor() rounds down to the nearest whole number. So this. turns decimals like 99.9 into 99
16
+
// + minimum since minimum = 1, this shifts the entire random range up by 1. so instead of 0-100, the range becomes 1-100
17
+
// num should return a random integer between 1 and 100
0 commit comments