Parameters or Arguments
The value to test whether it is an integer.
The isInteger() method returns true if the value is an integer. Otherwise, it returns false.
If the isInteger() approach is passed a non-numeric value, it will return false. This is due to the fact the isInteger() approach does NOT convert the fee to a number earlier than testing whether or not it is an integer.
The isInteger() method does NOT convert the cost parameter to a numeric cost earlier than deciding whether the price is an integer.
console.log(Number.isInteger(25)); console.log(Number.isInteger(6.7)); console.log(Number.isInteger('25'));
In this example, we have invoked the isInteger() approach the use of the Number class.
We have written the output of the isInteger() technique to the net browser console log, for demonstration purposes, to exhibit what the isInteger() approach returns.
The following will be output to the internet browser console log:
true false false
In this example, the first output to the console log again authentic seeing that 25 is an integer.
The second output to the console log again false considering that 6.7 is no longer an integer.
The 0.33 output to the console log returned false in view that the string cost ’25’ is no longer a quantity and the isInteger() method does not convert the fee to a wide variety before checking out whether or not it is an integer.