Last active
December 22, 2015 21:19
-
-
Save electricjesus/6532917 to your computer and use it in GitHub Desktop.
takes a start year and end year, returns an array of years that have four different numbers. http://imgur.com/gallery/rDJjm
This file contains 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(start, max) { | |
results = []; | |
for(i = start;i <= max; i++) { | |
var year = String(i); | |
var f = "0123456789" | |
.split("") | |
.filter(function(n) { | |
return year.indexOf(n) != -1 | |
}); | |
if(year.length === f.length) | |
results.push(year); | |
} | |
return results; | |
})(10,99999); |
This file contains 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(start, max) { | |
results = []; | |
for(i = start;i <= max; i++) { | |
var year = String(i); | |
if(year.length == 4) { | |
var f = "0123456789" | |
.split("") | |
.filter(function(n) { | |
return year.indexOf(n) != -1 | |
}); | |
if(f.length == 4) { | |
results.push(year); | |
} | |
} | |
} | |
return results; | |
})(1900,2040); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment