//去除数字元素数组
function sortnum(a, b) {
	return a - b;
}
Array.prototype.unique1 = function() {
	this.sort(sortnum);
	var newnumbers = [this[0]];
	for (var i = 0; i < this.length; i++) {
		if (this[i] != newnumbers[newnumbers.length - 1]) {
			newnumbers.push(this[i]);
		}
	};
	return newnumbers;
};
var mynums = [1, 2, 5, 8, 2, 5, 7, 42, 8, 0];
mynums = mynums.unique1();
console.log(mynums);

//利用json对象 可以取出非数字元素
Array.prototype.jsonUnique = function() {
	var json = {};
	for (var i = 0; i < this.length; i++) {
		if(!json[this[i]]){
			json[this[i]] = 1;
		}
	};
	return json;
};

var mynumss = [1,2,54,1,43,54,'哈哈','哈哈','我们','为什么','为什么'];
mynumss = mynumss.jsonUnique();
for(var key in mynumss){
	console.log(key);
}