<!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>
时间: 2024-10-25 16:48:57