tofixed is not a function javascript
// toFixed only exists on numbers.
// Trying to use it on another data type like strings will not work
// Example
let num = 1.23456;
num.toFixed(2); // 1.23
num = String(num);
num.toFixed(2); // Uncaught TypeError: num.toFixed is not a function
// Solutions
// Convert your string to a number by:
// - prepending it with a +
// e.g. (+num).toFixed(2);
// - using parseInt
// e.g. parseInt(num).toFixed(2)
// - using Number
// e.g. Number(num).toFixed(2)