Skip to content

Instantly share code, notes, and snippets.

@jasp402
Created June 12, 2018 17:18
Show Gist options
  • Save jasp402/459611a3b5ab88c52180884fd9d93c23 to your computer and use it in GitHub Desktop.
Save jasp402/459611a3b5ab88c52180884fd9d93c23 to your computer and use it in GitHub Desktop.
JavaScript - Generar un Array con el numero de días del mes actual
function daysInMonth() {
return Array.from({length: new Date(new Date().getFullYear(), new Date().getMonth(), 0).getDate()}, (x,i)=> { return (i+1); });
}
console.log(daysInMonth()); // 28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment