Basic Concepts of JavaScript Value Type Number methods and Properties

Shakil Chowdhury
2 min readMay 5, 2021

We know that JavaScript is the multi paradigm language with built in objects, methods and types of operators. JavaScript also supports Object oriented and functional programming also.

Lets go through the types of JavaScript values.

The core JavaScript value types are : -

1. Number

2. String

3. Boolean

4. Function

5. Object

6. Symbol

Here we will know more about Number type and String type.

NUMBER

It is a primitive wrapper object used to represent numbers like integers and other number types. It’s a function mainly which converts a string to other value to the number type.

Lets jump into some properties and methods of Number type and feel the power of javascript.

Number Properties

# Number.EPSILON

This property mainly represents the actual difference between the smallest floating number greater and 1 and 1. We don’t need to create number object to use EPSILON property.

# Number.MAX_VALUE

By MAX_VALUE property it mainly represents the maximum numeric value representable in JavaScript.

# Number.MIN_VALUE

By using MIN_VALUE property it represents the smallest numeric positive number value which is representable in javascript.

# Number.NAN

NAN stands for not a number so this property represents not a number value.

Now we will get some ideas about javascript Number methods.

*Number.isFinite()

By is isFinite we can examine the whether the number is a finite value or not. For this we have to pass a value within the method.

For example we can see : -

console.log(Number.isFinite(1 / 0));output: false

*Number.isInteger()

Mainly isInteger() method stands for checking a passing value is interger value or not. If we pass a float value within isInteger it will examine the value and returns false. Mainly it will return Boolean value true or false.

Example : -

console.log(Number.isInteger(5 / 2))Output: false

*Number.isNaN()

This method checks the passed value is a number or not. By isNaN() method we have to pass a value. If we pass a value which is not a number then it will return a Boolean value of true otherwise false.

Example : -

console.log(Number.isNaN(‘x’))Output: true

*Number.parseFloat()

This method will convert a number or integer value to a float number. We have to pass the value within the parseFloat() property and then it will convert the number value to a float.

Example: -

const integer = 5;console.log(Number.parseFloat(integer))Output: 5.000000000000000

*Number.prototype.toFixed()

The toFixed() method mainly fix the position of a float number value using fixed point notation.

Example : -

const floatNumber = 54.5566console.log(floatNumber.toFixed(2))output: 54.55

This is some important features about JavaScript Number type.

Thanks all for reading my article. If you have any tips or any ideas you can share in comment box.

--

--

Shakil Chowdhury

Web development and Web technologies are my passion from early years. And I am very well determined about my passion.