日期:2014-05-16 浏览次数:20426 次
var s1='a,b,c,d'; var s2='a,c,d,b'; var arr1 = s1.split(','); var arr2 = s2.split(','); var right = 0; var wrong = 0; var total = arr2.length; for(var i=0; i<total; i++){ if(arr1[i] == arr2[i]){ right++; } else { wrong++; } } alert('正确率:' + right/total);