I'm getting value like this.
data[0].percentage='0.0000'
I want this value as =
'0.00'
how to convert
'0.0000' to '0.00'
i tried
parseFloat(data[0].percentage).toFixed(2)
im getting NaN
CodePudding user response:
const percentage = '0.0000';
console.log(Number(percentage).toFixed(2));