Yogesh Chauhan's Blog

# Values and Types Basics in JavaScript

in JavaScript on February 27, 2020

### Numbers

We can write down numbers with or without decimals. For e.g. var x = 3.14 , var y = 3

To write down extra large or extra small numbers, we need to use exponent notation. For e.g. var x = 123e5 , var y = 123e-5

### Unique Numbers

There are “special numeric values” which also called Unique Numbers. For e.g. Infinity, -Infinity and NaN. Infinity represents the mathematical Infinity ∞. It is greater than any number.

### NaN

NaN actually is a computational error. It is a result of an incorrect or an undefined mathematical operation. The NaN property represents "Not-a-Number" value which indicates that a value is not a legal number. NaN compares unequal (via ==, !=, ===, and !==) to any other value — including to another NaN value.

To write down extra large or extra small numbers, we need to use exponent notation. For e.g. NaN === NaN; will output "false", isNaN(NaN) will output "true"

### Strings

A string can contain zero or more characters written inside quotes. For e.g. var car='Tesla', var car="Tesla" , both are same.