Skip to content

Instantly share code, notes, and snippets.

@bh-lay
Created October 30, 2014 06:09
Show Gist options
  • Select an option

  • Save bh-lay/e837c40d2846525397ce to your computer and use it in GitHub Desktop.

Select an option

Save bh-lay/e837c40d2846525397ce to your computer and use it in GitHub Desktop.
check a variable is number include like number string
/**
* 检测是否为数字
* 兼容字符类数字 '23'
*/
function isNum(ipt){
return (ipt !== '') && (ipt == +ipt) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment