Created
October 29, 2014 17:00
-
-
Save Shiggiddie/ac3c81bd737ccd28564b to your computer and use it in GitHub Desktop.
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
// Month Names | |
var monthName = function() { | |
var names = ["January", "February", "March", "April", "May", | |
"June", "July", "August", "September", "October", | |
"November", "December"]; | |
return { | |
name: function(number) { return names[number]; }, | |
number: function(name) { return names.indexOf(name); } | |
}; | |
}(); | |
console.log(monthName.name(2)); | |
// → March | |
console.log(monthName.number("November")); | |
// → 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment