`
annan211
  • 浏览: 448028 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

js 数组操作 array

阅读更多
两个 js Array 数组比较中  去除另外一个数组中的数据  如1 2 3 4 5 移除其中的2 3 当出现浏览器不兼容的时候,可以换种思想避免此类问题
var databaseArray = new Array();//新创建的数组
//selection_id 已存在的并且装有数据的数组  如 1 2 3 4 5
//click_remove被比较的 准备被移除的数据所在的数组 2 3 
						for(var i=0;i<selection_id.length;i++){
							for(var j =0;j<click_remove.length;j++){
								if(selection_id[i]!=click_remove[j]){
									databaseArray.push(selection_id[i]);
								}
							}
						}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics