Skip to content

Commit 11ef25e

Browse files
authored
Improve comments in random.js for better clarity
Updated comments for clarity and understanding of Math methods.
1 parent c2914d1 commit 11ef25e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ console.log(num);
1111
//First, const minimum and const maximum are variables
1212
// = is the assignment operator
1313
// what comes after = is what the variable will store
14-
// Math.floor is a method, and here we are telling it that its argument is to use the random method
15-
// and multiply the result before rounding with the maximum and minimum variables we created
1614
// * is a multiplication operator
1715
//To understand what is going on, we need to understand what the floor and random methods do
18-
//Math.floor (rounds down) and then pass it to Math.floor
19-
//We are asking the program to round whatever result we have to the nearest whole number
16+
// Math.floor rounds down what ever it has inside its parenthisis,
17+
//and because math.random is inside the parenthises the calculation is performed first before we do any rounding.
18+
//Also, once the rounding is done + minimum is added.so math.floor round down for example if the calculation give 4.9 it rounds to 4,
19+
//than + minimum take that result and adds to it 1 making it 5
2020

2121
//done

0 commit comments

Comments
 (0)