The entries() method of an array returns an iterator object that contains the key/value pairs for each index in the array.

  
  const cities = ["Detroit", "Miami", "New York", "Boston"];

  // iterator object
  const iterator = cities.entries();

  console.log(iterator.next().value);
  // [0, "Detroit"]

  // for of loop over iterator object
    for (const city of iterator) {
      console.log(city);
    }
  // [1, "Miami"]
  // [2, "New York"]
  // [3, "Boston"]