var str="36,35,26,41,42,36,36,35,41,25,26,";var ret = [];var re = str.split(',');str.replace(/[^,]+/g, function($0, $1) { (str.indexOf($0) == $1) && ret.push($0)})alert(ret)
转载于:https://www.cnblogs.com/huangtailang/archive/2011/05/19/2051139.html