Is there a way to generate sequence of characters or numbers in javascript?
For example, I want to create array that contains eight 1s. I can do it with for loop, bu
2016 - Modern Browser functionality has arrived. No need for jquery all the time.
Array.from({length: 8}, (el, index) => 1 /* or index */);
You can substitute the arrow function with a simple callback function to reach a slightly wider range of supported browsers. It's, for me at least, the easiest way to iterate over an initialized array in one step.
Note: IE is not supported in this solution, but there is a polyfill for that at developer.mozilla.org/...