DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Array Sub
// description of your code here
//陣列相減 array1 - array2
function array_cut(array1, array2){
var flag;
var temp_array = [];
for (var i=0; i < array1.length; i++){
flag = 0;
for (var j=0; j < array2.length; j++) {
//表示有相åŒçš„, 所以會被剪掉
if (array1[i] == array2[j]) {
flag = 1;
}
}
//如果還是0 表示都沒相åŒçš„, 所以會留下來
if (flag == 0) {
temp_array.push(array1[i]);
}
}
return temp_array
}





