Skip to content

Commit 2582f53

Browse files
committed
add comments to the comment section for further explanation
1 parent 36dd0c6 commit 2582f53

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ const maximum = 100;
33

44
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
55

6-
//num represents a number
7-
//lets start by (maximum-minimum +1) which the output is 100.
8-
//math.random()*100 returns random number between 0 and 100
9-
//math.floor()it rounds a number to thier nearest integer,
10-
//at the end we add 1.
6+
//1.num represents a number which is an Integer.
7+
//2.lets start by (maximum-minimum +1) which the output is 100.
8+
//3.math.random()*100 returns random number between 0 and 100, what actually
9+
// happens is that math.randum gives out random number from 0 to 1 which 1 is
10+
// not included and in this case, multiply the out put by 100.
11+
//4.math.floor()it rounds a number to thier nearest integer, which means it drops all the decimal.
12+
//5.at the end we add 1 which is the minimum.
1113
console.log(num);

0 commit comments

Comments
 (0)