Created
October 24, 2017 08:41
-
-
Save 1000copy/fd25640b0106aa074965d1cf69d27679 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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