メモ
function isInteger(x) {
return Math.round(x) === x;
}
> isInteger(1)
true
> isInteger(0)
true
> isInteger(1.111)
false
> isInteger("1")
false
> isInteger("")
false
> isInteger(null)
false
> isInteger(NaN)
false
> isInteger(undefined)
false
Go to list of users who liked
More than 5 years have passed since last update.
メモ
function isInteger(x) {
return Math.round(x) === x;
}
> isInteger(1)
true
> isInteger(0)
true
> isInteger(1.111)
false
> isInteger("1")
false
> isInteger("")
false
> isInteger(null)
false
> isInteger(NaN)
false
> isInteger(undefined)
false
Register as a new user and use Qiita more conveniently
Go to list of users who liked