Last active
April 30, 2019 19:36
-
-
Save tamunoibi/14e2c02d32ac4aeb2644c3a32f5e3b48 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
| //This returns true if the number is repeated | |
| function isRepeated(num) { | |
| let unique = []; | |
| let numArr = num.toString() | |
| .split(''); | |
| for (var i = 0; i < numArr.length; i++) { | |
| //if the number is not already in unique, push it to unique | |
| if (unique.indexOf(numArr[i]) === -1) { | |
| unique.push(numArr[i]); | |
| } else { | |
| return true; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment