$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · easy · #280

What goes in the blank?

// random whole number from 0 to 5
const r = Math.____(Math.random() * 6);

Answer: floor (also accepted: floor, Math.floor, trunc)

Math.random() * 6 lies in [0, 6); flooring it gives 0..5 with equal odds.
Play Problem Solving ▸