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

14th Feb 2021, 8:54 AM
onekpsc
5 Answers
+ 1
ATTEMPT 01: const myFunction=hashNum=> hashNum%1!=0?true:false ATTEMPT 02: const myFunction=hashNum=> Number.isInteger(hashNum)?true:false
14th Feb 2021, 9:42 AM
onekpsc
+ 1
ATTEMPT 03: (Worked) console.log((n=>n-Math.floor(n)!==0?true:false)())
14th Feb 2021, 10:03 AM
onekpsc
+ 1
Aysha please share if you have good logic to solve this , thank you
14th Feb 2021, 10:07 AM
onekpsc