We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 697d88c commit 519042cCopy full SHA for 519042c
Sprint-1/1-key-exercises/4-random.js
@@ -7,3 +7,8 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
7
// Try breaking down the expression and using documentation to explain what it means
8
// It will help to think about the order in which expressions are evaluated
9
// Try logging the value of num and running the program several times to build an idea of what the program is doing
10
+
11
+// First, maximum - minimum + 1 is calculated, so 100 - 1 + 1 equals 100.
12
+// Then, a random fractional number between 0 and 1 is chosen(except 1), for example 0.3.
13
+// Next, Math.random() * 100 gives 30.
14
+// Math.floor rounds this number down to the nearest integer, and the final step adds 1, giving 31.
0 commit comments