DEV Community

karim coda
karim coda

Posted on

Infinity (javascript)

What is Infinity

An infinite value that is used as numbers in variables, infinity is classified as a property of a window object

Alt Text

Alt Text

When is Infinity Returned?

1-Infinity is returned when the value is more or less than the value spcified in your code that, if you set the value between 10 and 1000 and the value is more than 100,it returns infinity and if it is less than 10, it returns infinity.

2-when do you write more than 308 numbers, it will give you infinity.

Alt Text

Alt Text

3- Infinity will be returned when a number is divided by 0:

Alt Text

Alt Text

4- Number.POSITIVE_INFINITY
Alt Text

Alt Text

For more information about this read article about infinity link⬇️⬇️ :
https://www.impressivewebs.com/infinity-in-javascript/

Top comments (0)