I have tried using toString()
and the bitwise operator |
but I would like to use the precision and string output. As @trincot mentioned, it is caused by the precision value for e.g. -0.45 will result in -0. I have the code here.
typeof predictedHours //number e.g. -0.45
precision = 0
value={predictedHours.toFixed(precision)}
typeof value //string e.g. "-0"
Question - Is there a one liner to convert -0 to 0 in this line - value={predictedHours.toFixed(precision)}
?