diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json index d1ca00ef8f..5dfe389209 100644 --- a/challenges/01-front-end-development-certification/basic-javascript.json +++ b/challenges/01-front-end-development-certification/basic-javascript.json @@ -3958,7 +3958,7 @@ "It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers.
Math.random()
to generate a random decimal.20
.Math.floor()
to round the number down to its nearest whole number.Math.random()
can never quite return a 1
and, because we're rounding down, it's impossible to actually get 20
. This technique will gives us a whole number between 0
and 19
.",
"Putting everything together, this is what our code looks like:",
"Math.floor(Math.random() * 20);
",
- "See how Math.floor
takes (Math.random() * 20)
as its argument? That's right - you can pass a function to another function as an argument.",
+ "We are calling Math.random()
, multiplying the result by 20, then passing the value to Math.floor()
function to round the value down to the nearest whole number.",
"0
and 9
."
],