πŸ“Š JavaScript
Q. Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ?
  • (A) ExitIteration
  • (B) AbortIteration
  • (C) Abort
  • (D) StopIteration
πŸ’¬ Discuss
βœ… Correct Answer: (D) StopIteration

Explanation: Iterators that work on finite collections throw StopIteration from their next() method when there are no more values to iterate. StopIteration is a property of the global object in JavaScript 1.7. Its value is an ordinary object (with no properties of its own) that is reserved for this special purpose of terminating iterations. Note, in particular,that StopIteration is not a constructor function like TypeError() or RangeError().

Explanation by: Mr. Dubey
Iterators that work on finite collections throw StopIteration from their next() method when there are no more values to iterate. StopIteration is a property of the global object in JavaScript 1.7. Its value is an ordinary object (with no properties of its own) that is reserved for this special purpose of terminating iterations. Note, in particular,that StopIteration is not a constructor function like TypeError() or RangeError().

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
214
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
84%
Success Rate