Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to know if a number has a decimal number js

function hasDecimal (num) {
	return !!(num % 1);
}
hasDecimal(2) // true
hasDecimal(2.345) // false
 
PREVIOUS NEXT
Tagged: #number #decimal #number #js
ADD COMMENT
Topic
Name
1+8 =