A callback function is a function passed into another function as an argument. This function is invoked inside the outer function to complete an action. Let’s take a simple example of how to use callback function
In the example below…
An iterator is an object which defines a sequence and a return value upon its termination. It implements the Iterator protocol with a
next() method which returns an object with two properties:
value (the next value in the sequence) and
done (which is true if the last value in the sequence has been consumed.
The simplest way to create an empty object is using the Object constructor. Currently, this approach is not recommended.