JavaScript and Number Serialization

Greg Pabian
Level Up Coding
Published in
7 min readFeb 23, 2023

--

Imagine I am writing a simple JavaScript/TypeScript application.

It needs to write a number into a file, and I intend for everyone else to read that numeral later on.

Does it sound complicated to you?

Can I just cast that primitive into a string and write it into the file?

The correct answer is: it is not that trivial.

I will explain in this article how to serialize numbers in JavaScript and TypeScript projects.

--

--