I made a form where the user inputs values for width and height that they want for the pop up window to be. I am using window.open for that.
So I thin
An alternative answer if you worry about performance.
var isInteger1 = function(a) {
return ((typeof a !== 'number') || (a % 1 !== 0)) ? false : true;
};
Load test results compared to Zafer's answer in Chrome:
undefined => 4ms vs 151ms
1 => 10ms vs 390ms
1.1 => 61ms vs 250ms
'1' => 8ms vs 334ms
[1] => 9ms vs 210ms
{foo: 'bar'} => 8ms vs 478ms
See for yourself: jsfiddle