Categories
JavaScript Answers

How to convert a string to long in JavaScript?

Spread the love

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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.