Photo by Logan Kirschner from Pexels

Python vs JavaScript: Numbers

--

Are you a full-stack Python developer? Or maybe you know Python and want to learn some differences with JS? Sometimes things are easier to remember when put in comparison, so here is a simple cheatsheet of the implementation of numbers in both languages.

Python 3 and a “modern” JS engine are assumed (V8, SpiderMonkey, JavaScriptCore).

Integers

Standard integer (Python int vs JS Number)

Built-in integers with arbitrary precision (Python int vs JS BigInt)

Floats

Python float vs JS Number

Infinity

Not-A-Number

Arithmetic operators

Formatting

Alternatives

JS

Build-in TypedArray
Nodejs C++ addons

Python

Numeric and Mathematical Modules
Numeric and Scientific libs

--

--