Nodejs Utililty Methods Array Range

List of utility methods to do Array Range

Description

The list of methods to do Array Range are organized into topic(s).

Method

range(start,end)
Array.prototype.range = function(start,end){
  return Array.apply(null, Array(end-start+1)).map(function (_, i){
      return start+i;
  });
};
range(start,end,step)
Array.prototype.range = (start,end,step)=>{
    const stepVal = step || 1
    const set = new Set()
    for (var i=start;i<=end;i=i+stepVal){
        set.add(i)
    return [...set]
Set.prototype.union = function (set) {
...
rangeArray(startIndex, endIndex)
Array.prototype.rangeArray = function (startIndex, endIndex) {
  var arr = []
  for(var i=startIndex; i<endIndex; i++) {
    arr.push(i);
  return arr;