無法獲得比較到for循環,並生成警報或日誌,找到重複的元素角,jQuery的不能到陣列中的控制器
var a1=['sdfsdf','sdfs','rere','112'];
var a2=['333','666','888','112'];
var resultant=[];
resultant=a1.concat(a2);
console.log(resultant); // able to find the a1 and a2 merged
console.log(resultant.length); // able to find the length .,
for(var i=0;i<resultant.length;i++)
{
console.log(resultant.length);
var k=i;
alert("test");
if(resultant[k]==resultant[k+1])
{
console.log(resultant[i]);
console.log(resultant[i+1]);
alert("duplicate");
}
}
https://jsfiddle.net/h9945394143/2m3dk553/5/
什麼是你的問題?如需幫助,請參閱「[如何提出一個好問題](http://stackoverflow.com/help/how-to-ask)」。 – jacefarm