-2
說,一個元素我有2列:如何挑出兩個陣列的
var array1 = [1, 2, 3];
var array2 = [1, 2, 3, 4];
如何對它們進行比較挑出元素(在這種情況下,4號)?
喜歡的東西:
if (array1 == array2) {
//then do this
}else{
// find out the one that isn't the same in each and show it here
}
簡單谷歌搜索「javascript數組比較 - 找到差異顯示此:http://stackoverflow.com/questions/3432929/comparing-two-arrays-in-javascript-returning-differences – Snowmonkey
如果'var array1 = [ 1,2,3,4]; var array2 = [1,2,3];'&'var array1 = [1,2,3]; var array2 = [1,2,4];' –