Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 11: Managing Errors, Debugging, and Handling Events in JavaScript!

Instruction

Iterating over a custom iterable

Custom iterables can be created by implementing the Symbol.iterator method. You must be certain that your iterator method returns an object which is an iterator, which is to say it must have a next method.

const myEmptyIterable = {
 [Symbol.iterator]() {
   return []; // [] is iterable, but it is not an iterator — it has no next method.
 },
};
Array.from(myEmptyIterable); // Type...