Skip to content

Instantly share code, notes, and snippets.

@mmoehrlein
Created November 24, 2021 14:23
Show Gist options
  • Select an option

  • Save mmoehrlein/652ca678fc3d6032b4e2ccef045a6acb to your computer and use it in GitHub Desktop.

Select an option

Save mmoehrlein/652ca678fc3d6032b4e2ccef045a6acb to your computer and use it in GitHub Desktop.
js - generate an array with sequential numbers
/**
* Generate a Array with sequential numbers.
*
* @param start first value
* @param stop last value
* @param step step size
* @returns {Array}
*/
function range(start, stop, step){
return Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment