How to convert a string to a 19-digit number in javaScript without automatic rounding?
P粉652495194
P粉652495194 2024-03-30 14:42:35
0
1
491

We have string input numbers input="6145390195186705543" If we want to convert to a number; the java script automatically rounds this input;

(6145390195186705543)

(6145390195186705000)

P粉652495194
P粉652495194

reply all(1)
P粉025632437

This should suit what you want to achieve

const myFunction = (num) => {

const length = num.length;

const result = `(${num.slice(0,16).padEnd(length, "0")})`;
return result;
};

const input="6145390195186705543";
const output = myFunction(input); 
console.log(output)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template