<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var Narr = new Array("111","ff","222","aa","222");
if(repetition(Narr)){
alert('有重复项')
}
// 验证重复元素函数,有重复返回true;否则返回false
function repetition(a){
return /(\x0f[^\x0f]+)\x0f[\s\S]*\1/.test("\x0f"+a.join("\x0f\x0f") +"\x0f");
}
</script>
</body>
</html>