0
How to solve this ?
// Write a function that takes a number as argument // If the number is a whole number (has no decimal place), return true // Otherwise, return false console.log(myFunction(4)) //true console.log(myFunction(12.0)) // false Like So
5 Answers
+ 1
ATTEMPT 01:
const myFunction=hashNum=>
hashNum%1!=0?true:false
ATTEMPT 02:
const myFunction=hashNum=> Number.isInteger(hashNum)?true:false
+ 1
ATTEMPT 03: (Worked)
console.log((n=>n-Math.floor(n)!==0?true:false)())
+ 1
Aysha please share if you have good logic to solve this , thank you