Skip to content

Commit f60234b

Browse files
added console log and comments explaining the process
1 parent 4c84db9 commit f60234b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77
// Try breaking down the expression and using documentation to explain what it means
88
// It will help to think about the order in which expressions are evaluated
99
// Try logging the value of num and running the program several times to build an idea of what the program is doing
10+
11+
console.log(num);
12+
13+
//num is a random number between 1 and 100
14+
//Math.floor rounds the decimal number to nearest lower number
15+
// Math.random() generates a random decimal number between 0 and 1
16+
// when max – min need to add +1 or not all the numbers will be
17+
// included for instance max=5 min=1 5-1=4 but there are
18+
// 5 numbers, 1, 2, 3, 4,5 so need to +1
19+
//• + minimum → shift the range up to start at the minimum value

0 commit comments

Comments
 (0)