Answers for "if value has decimals javascript"

4

has decimal javascript

// check if num has decimal value.

num % 1 !== 0
// if any number on right of decimal other than 0, returns true

// Eg
5   % 1 !== 0 // false
5.0 % 1 !== 0 // false
5.1 % 1 !== 0 // true
Posted by: Guest on January-08-2022
7

js check if number has decimals

num % 1 != 0
Posted by: Guest on October-23-2020

Code answers related to "if value has decimals javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language