for
let arr = [12, 23, 34]
arr[Symbol.iterator] = function () {
let self = this,
index = 0;
return {
next() {
if(index > self.length-1){
return {
done: true,
value: undefined
}
}
return {
done: false,
value: self[index++] + 1
}
}
}
}
> for(let i of arr){console.log(i)}
13
24
35