This while loop should have terminated when it encountered the *,as parseInt(num[1])=NaN.Bu it keeps on iterating.Whys?
var num=["1","*","2","3","4"]
var index=4
var eachop=1;
while((parseInt(num[index]))!=NaN){
num[index]=eachop;
index=index-1;
console.log(index);
}