$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #66

What is the output?

console.log(Math.round(-0.5), Math.round(0.5));
  1. -0 1
  2. -1 1
  3. 0 0
  4. -1 0
Math.round breaks ties toward +Infinity, so -0.5 rounds up to -0.
Play Problem Solving ▸