Skip to content

Instantly share code, notes, and snippets.

@henryspivey
Forked from prof3ssorSt3v3/14-is-int.js
Last active October 30, 2019 21:50
Show Gist options
  • Save henryspivey/bbf0eae9e83d7ef497f6835a53fd2030 to your computer and use it in GitHub Desktop.
Save henryspivey/bbf0eae9e83d7ef497f6835a53fd2030 to your computer and use it in GitHub Desktop.
/**
* Write a function to determine if a number is an integer
*/
let isInt = function (num) {
return (!isNaN(num) && parseInt(num) === num)
}
console.log(3, isInt(3));
console.log(3.5, isInt(3.5));
console.log(1.00000, isInt(1.00000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment