In order to make an object iterable with a for...of loop, you need to define its _______ method.

  • loop
  • forEach
  • Symbol.iterator
  • Object.iterable
To make an object iterable with a for...of loop, you need to define its Symbol.iterator method. This method should return an iterator object, which must have a next method that provides values one at a time. This enables you to use a for...of loop to iterate over the object's elements.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *