Learning in detail about Number of Variables in JavaScript - Technology & Web designing

Breaking

Sunday, 17 May 2020

Learning in detail about Number of Variables in JavaScript



Number :

The Number data type is used to store numeric values.

The simplest type of number is an integer. JavaScript can handle integer between 253 and -253. Some JavaScript functions, cannot handle extremely large or small numbers, so in most programs it is ideal to keep numbers in the range of 231 and -231.

All of the following are valid integers.

0

-75

10000000

2

Another commonly used type of number is a floating-point number. A floating-point number is a number that is assumed to have a decimal point. Floating-point numbers have a fractional component, even if that fractional component is zero. They can be represented as a real number (integer - decimal point - fractional value) such as in 3.1714, or using exponential notation.

All the following are valid floating-point numbers.

5.00

1.3333333333333

1.0e25

7.5e-3

JavaScript also has the ability to handle hexadecimal and octal numbers.

JavaScript also has some numeric keyword litrerals you should know about. These are listed below.

  • Infinity : infinity us defined in JavaScript as number larger than the largest number that JavaScript can represent. There is also the keyword literal-Infinity for the negative infinity.
  • NaN : NaN is the value returned by JavaScript when the Program tries to treat something that is not a number as a number. For instance the results of 7 times "abc" is not a number.
  • Number.MAX_VALUE : Number.MAX_VALUE represent the largest representable number for JavaScript.
  • Number.MIN_VALUE : Number.MIN_VALUE represent the small representable non-zero number JavaScript. In other words as close as JavaScript can get to zero with actually reaching zero.
In next post we will learn in detail about String & Boolean in JavaScript.

No comments:

Post a Comment

If you have any doubts regarding this please comment or email us.