首页 > 编程语言 > 详细

js 数组去重复

时间:2015-04-26 22:45:16      阅读:312      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
	window.onload = function (){
		var arr = [11,13,22,11,5,13,7];

		function show(arr){
			var result = [ arr[0] ];
			for(var i = 0; i < arr.length; i++){
				if( toCon(arr[i]) ){
					result.push(arr[i]);
				}
			}

			function toCon(){
				for(var i = 0; i < result.length; i++){
					if( num == result [i]){
						result false;
					}
				}
				return true
			}
			return result;
		}

		console.log(show( arr ));
		
	}
	</script>>
</head>
<body>
	
</body>
</html>

  

js 数组去重复

原文:http://www.cnblogs.com/mayufo/p/4458522.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!