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

What is logged?

console.log((0.1 * 3).toFixed(2), typeof (1).toFixed(1));
  1. 0.30 string
  2. 0.3 number
  3. 0.30 number
  4. 0.3 string
toFixed keeps trailing zeros and always returns a string.
Play Problem Solving ▸