Home HTML CSS JAVASCRIPT BOOTSTRAP Python Docker ML tutorial About us Privacy policy

Numbers in JavaScript



Number's in JavaScript



JavaScript supports number data types as well,which means we can use number types values in JavaScript can be with decimal or without decimal no problem at all.




We can also use large decimal numbers in JavaScript but we use exponentiation form in that particular section.


Addition of Numbers and Strings

We can add numbers and strings in JavaScript by using + operator.If at least one value is string then complete value will be string.


If we keep those numbers inside quotes then the result will be different.


If at least one value as a string then complete result will be string.



String in Numeric Format

If we keep numbers around quotes then those numbers will become numeric string values.We can perform all operations accept (+) addition operation.







Nan in JavaScript

In JavaScript Not a Number(Nan) is a reserved word,which shows that given number is not in a valid format or acceptable format.


In JavaScript there is a function isNaN(),it return's true if a given number is not in a legal format and return false if a number is a legal format .


Hexadecimal Numbers

In JavaScript numbers can be written in the form of hexadecimal as well.


Number as a object

In JavaScript we can declare number as object form as well by using Number constructor.