Skip to content

Instantly share code, notes, and snippets.

@queviva
Last active December 15, 2023 19:38
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 queviva/c889fa4d02751879dd94504690248865 to your computer and use it in GitHub Desktop.
Save queviva/c889fa4d02751879dd94504690248865 to your computer and use it in GitHub Desktop.
list of month names
const // create a var ...
months // called months ...
= // that is equal to ...
[...Array(12)] // a twelve element array ...
.map( // that gets mapped using ...
(v,i) => // an arrow function that ...
(new Date( // creates a new date of ...
0, // the year zero and ...
i // the index of the next month ...
)) // then
.toString() // converts that to a string and ...
.split(' ') // makes that string an array and ...
[1] // returns the 1th member of that array ...
); // then ends the map
console.log(months.join(' ')); // check it out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment