Sometimes, we want to convert a string to long in JavaScript.
In this article, we’ll look at how to convert a string to long in JavaScript.
How to convert a string to long in JavaScript?
To convert a string to long in JavaScript, we can convert it to a bigint.
For instance, we write
const bi = BigInt("1274836528318476135");
to convert the "1274836528318476135"
string to a bigint with the BigInt
function.
Conclusion
To convert a string to long in JavaScript, we can convert it to a bigint.