The value of the special Infinity number encapsulates the concept.
This meant for comparison. By definition, you cannot do arithmetic with it.
Assume a password expiration value. If you select the "Never expire" checkbox, you can set the internal value of Infinity . Any comparison of actualDate < expiryDate will be evaluated as true (except, of course, if actualDate is Infinity ).
This is much better than defining the βno expiryDate β state as an arbitrary value, for example 0 or -1 or null or undefined , where you must maintain and remember what this value conceptually means in your application, presenting a new potential error on each line, where the date is compared.
source share