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