I am using javascript number.toFixed() function.
My problem is I have to explicitly mention number of fractional length like below:
if number is 1e11 then I have to specifiy it as
number.toFixed(2)
or if number is 1e1 then :
number.toFixed(1)
or if its 1e0 then
number.toFixed(0)
I want to do it dynamically based on whether fractions present or not. and irrespective of fractional length.
I dont want to pass parameter of fixed fractional length. js should dynamically understand fractional length of it. Is there similar provision in JS? or is there any similar function in java script where I need not to explicitly pass parameter of fixed length?