Skip to content

Instantly share code, notes, and snippets.

@electricjesus
Last active December 22, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electricjesus/6532917 to your computer and use it in GitHub Desktop.
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
(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);
(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