Skip to content

Instantly share code, notes, and snippets.

@yuu-nkjm
Created September 25, 2014 23:49
Show Gist options
  • Save yuu-nkjm/1bc4ec82af31eca14e23 to your computer and use it in GitHub Desktop.
Save yuu-nkjm/1bc4ec82af31eca14e23 to your computer and use it in GitHub Desktop.
数値化であるかを判定する関数
function isNumber(x){
if(typeof(x) == 'number'){
return true
}
if(typeof(x) == 'string' && x.match(/[^0-9]/g)){
return false;
}
return (x == parseFloat(x) && isFinite(x));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment