Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript fill array with range

function range(start, end) {
  return Array(end - start + 1).fill().map((_, idx) => start + idx)
}
var result = range(9, 18); // [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
console.log(result);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #fill #array #range
ADD COMMENT
Topic
Name
5+6 =