Skip to main content
3 of 4
deleted 1 character in body
Nate
  • 6.5k
  • 3
  • 27
  • 31

In ES6 you can do:

Array(N).fill().map((e,i)=>i+1);

http://jsbin.com/molabiluwa/edit?js,console

Edit: Changed Array(45) to Array(N) since you've updated the question.

Nate
  • 6.5k
  • 3
  • 27
  • 31