這是正確的方式來顯示下一個項目名稱在jquery每個還是有更好的方法嗎?jquery如何顯示每個值和下一個值?
a=[4,5,89,2,19];
$(a).each(function(i,v){
console.log('this item is called '+v+' at position '+i);
if(i<a.length){
console.log('the next item is at position '+(i+1));
console.log('its name is '+a.indexOf(i+1));
}
});
你爲什麼不使用本地JavaScript'爲(VAR I = 0; ....)'循環。 –