check if number has no decimal javascript code example

Example 1: javascript show 2 decimal places

var myNumber=12.2345;
var myNumberWithTwoDecimalPlaces=parseFloat(myNumber).toFixed(2); //12.23

Example 2: js check if number has decimals

num % 1 != 0

Example 3: javascript no decimal places

decimal.toFixed();
// return 6

decimal.toFixed(2)
// returns 5.68

decimal.toFixed(1)
// return 5.7

Example 4: check to see if number is a decimal javascript

The Number. isInteger() method determines whether a 
value an integer. 
This method returns true if the value is of the type 
Number, and an integer (a number without decimals). 
Otherwise it returns false.