<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<script type="text/javascript">
var arr=['c','a','z','a','x','a','x','c','b']
var log=[];
for (var i=0;i<arr.length;i++) {//遍历数组
if (log.indexOf(arr[i])==-1) {//如果第一次出现的位置为-1(没出现过),
log.push(arr[i])//将它存到log的数组中
}
}
console.log(log)
</script>
<body>
</body>
</html>