1

Why does .toFixed() round differently in each of the following situations?

console.log((1.35).toFixed(1)); //1.4
console.log((6.35).toFixed(1)); //6.3
  • from mdn site `2.55.toFixed(1) // Returns '2.5': it rounds down as it can't be represented exactly by a float and the closest representable float is lower` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed – Chris Li Jul 28 '22 at 17:14
  • Does this answer your question? [Javascript toFixed Not Rounding](https://stackoverflow.com/questions/10015027/javascript-tofixed-not-rounding) – soupy-norman Jul 28 '22 at 17:18

0 Answers0