When searching for this I found dozens of implementations doing things like parsing each character, string manipulation, and more. But one of the best solutions i could come up is this:
1: function isInteger(val) {
2:
3: return (val == null || isNaN(val)) ? false :
4: ( ((1.0 * val) == Math.floor(val)) && (val.indexOf(".") == -1));
5:
6: }