function makeIterator(array){

var nextIndex=0;

return {

next:function(){

// The value attribute represents the value of the current member, and the done attribute is a Boolean value indicating whether the traversal is complete.

return nextIndex<array.length? {value:array[nextIndex],done:false}:{value:undefined,done:true};

}

};

}

———————

Author: qq_41805715

Source: CSDN

The original:Blog.csdn.net/qq_41805715…

Copyright notice: This article is the blogger’s original article, reprint please attach the blog link!