Skip to content

Instantly share code, notes, and snippets.

@1000copy
Created October 24, 2017 08:41
Show Gist options
  • Select an option

  • Save 1000copy/fd25640b0106aa074965d1cf69d27679 to your computer and use it in GitHub Desktop.

Select an option

Save 1000copy/fd25640b0106aa074965d1cf69d27679 to your computer and use it in GitHub Desktop.
function isInt(str){
var i
for (i = 0; i < str.length; i++) {
var c = str[i]
if (!"0123456789-".includes(c))
return false
}
if (str.includes("-") && str[0]!="-" || str.length==1)
return false
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment