I am trying to do a relatively simple task of writing 1000000000000000000000 (as a number without quotes) to a json file using NodeJs. I have this number defined as a constant:
const NUM = 1000000000000000000000
If I simply write it, it comes out as 1e+21
. Everything else I tried (big number...) ends up converting it to a string.
Can someone please help?
Update
To clarify what i am after, please look at the code below:
// 22 digits
const bigNum = 1000000000000000000000;
console.log(JSON.stringify(bigNum)); // Output: 1e+21
// 19 digits
const bigNum2 = 1000000000000000000;
console.log(JSON.stringify(bigNum2)); // Output: 1000000000000000000
What i would like is to be able to output 1000000000000000000000
in the first example instead of 1e+21