SOURCE

let Iterator = function(arr){
	if(!arr) {
		console.log("arr is illeague");
	}

	this.arr = arr;
	this.cursor = 0; //当前指针位置
	//this.step = 1; //默认步长为1
}
Iterator.prototype = {
	next : function(){
		while(this.cursor < this.arr.length){
			if( typeof this.arr[this.cursor] === 'number'){
				return(this.arr[this.cursor++]);
			}
			this.cursor++;
		}
	},
	hasNext : function(){
		let temp_cur = this.cursor;
		while(temp_cur < this.arr.length){
			if(typeof this.arr[temp_cur] === 'number'){
				return true;
			}
			temp_cur++ ;
		}
		return false;
	}
}

let t = [1,'b',42,3,'f',3,2,'c']
let it =new Iterator(t);
while(it.hasNext() !== false){
	console.log(it.hasNext(),it.next());
}
console 命令行工具 X clear

                    
>
console