how to know if a number has a decimal number js
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.function hasDecimal (num) {
return !!(num % 1);
}
hasDecimal(2) // true
hasDecimal(2.345) // false
Also in JavaScript:
- jquery enable textbox
- javascript open in new window not tab
- javascript got to url
- jquery select option by value
- javascript string in multiple lines
- how to change background color using js
- sort data according to date in js
- how pass data from body in koa js
- check if field exists in object javascript
- print javascript
- check for duplicates in array javascript
- how to put firebase config in a sperate file react native
- javascript unknown number of parameters
- how to register key presses in p5.js
- Error: node_modules/@angular/fire/database/interfaces.d.ts:2:10
- check if outside the div is clicked
- Javascript is object array
- validatorjs number
- check if string is datestring javascript
- operator sum string to character javascript
- how to print diamond pattern in javascript
- faher js
- convert object to array javascript
- 3. What are private member variables. in js