Created
March 23, 2017 14:41
-
-
Save amoilanen/f5372960aee1c6701f73635e69f1031b to your computer and use it in GitHub Desktop.
Lists all months names in the en-US locale in pure JavaScript (ES6)
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 listMonths() { | |
var currentDate = new Date(); | |
return Array.from(new Array(12), (_, monthIdx) => { | |
currentDate.setMonth(monthIdx); | |
return currentDate.toLocaleString("en-US", {month: "long"}) | |
}); | |
} | |
console.log(listMonths()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment