-
Notifications
You must be signed in to change notification settings - Fork 271
实现迭代器 #337
Copy link
Copy link
Open
Description
let arr = ["213", "asd", 2, 3, 14];
Array.prototype._interator = function () {
let i = 0;
return {
next: () => {
return {
value: this[i++],
done: i < this.length ? false : true,
};
},
};
};
let b = arr._interator();
console.log(b.next());
console.log(b.next());
console.log(b.next());
console.log(b.next());
console.log(b.next());Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels