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
Typescript method based on Ariya Hidayat code:
/**
* Generates sequence of numbers from zero.
* @ param {number} count Count of numbers in result array.
* @ return {Array} Sequence of numbers from zero to (count - 1).
*/
public static sequence(count: number): Array
{
return Array.apply(0, Array(count)).map((x, i) =>
{
return i;
});
}