Iterable object

How to make a Object Iterable.

by ruhul105

JavaScript

export default function fill(array, value, start = 0, end = array.length) {
  return array.map((item, index) => {
    if (index >= start && index < end) {
      item = value;
      return item;
    }
    return item;
  });
}

const arr = [1, 2, 3];
console.log(fill([1,2,3], '*', 1))