JS: IteratorResult Interface

By Xah Lee. Date: .

IteratorResult Interface is required as return value in JS: Iterator Interface .

IteratorResult Interface Properties

done

true or false

  • This is the result status of an iterator next method call.
  • If the end of the iterator was reached, done is true.
  • If the end was not reached, done is false and a value property is available.
  • If a done property (either own or inherited) does not exist, it is consider to have the value false.
"value"

Any JavaScript value.

  • If done is false, this is the current iteration element value.
  • If done is true, this is the return value of the iterator, if it supplied one.
  • If the iterator does not have a return value, value is undefined.
  • In that case, the value property may be absent from the conforming object if it does not inherit an explicit value property.

JavaScript, Iterable