0

How much space does Number.POSITIVE_INFINITY (aka Infinity) or Number.NEGATIVE_INFINITY take in memory for Javascript?

Hasan Sefa Ozalp
  • 2,344
  • 20
  • 27

1 Answers1

2

Infinity is a number, and all numbers are 64 bit IEEE 754 floating point values, so therefore Infinity is a 64 bit (8 byte) floating point. Realistically this is such a tiny amount that you shouldn't worry about it. Chances are if you're using it a lot, it's only getting assigned to one instance in memory anyway.

Nick McCurdy
  • 11,551
  • 3
  • 38
  • 65