Question · JavaScript and TypeScript course · Module 5: Advanced JavaScript

The Iterator Protocol

What object must the next() method of an iterator return in JavaScript?

Answer options

  • An object with value and done properties
  • An array with two elements [value, index]
  • A single value or null
  • A Promise with the next value

You can check the correct answer by solving this task in the CodeWorlds game.