Skip to content

Commit 622028f

Browse files
committed
complete 4-random exercise
1 parent 64ab32e commit 622028f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Sprint-1/1-key-exercises/4-random.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const maximum = 100;
44
const 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 is a randomly generated whole number in the interval [1, 100], meaning it can be any number from 1 to 100. It is created by generating a random decimal,
8+
// rounding it down, and shifting it to start at 1.
79
// Try breaking down the expression and using documentation to explain what it means
810
// It will help to think about the order in which expressions are evaluated
911
// Try logging the value of num and running the program several times to build an idea of what the program is doing
12+
// When I ran the program several times, num always produced a different whole number between 1 and 100,
13+
// This shows that the program generates a new random number each time it runs.

0 commit comments

Comments
 (0)