1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <script type="text/javascript"> var a = ["13", "3123", "3131", "431321", "343123"]; var b = ["343123", "13", "3123", "3131", "431321"];
function same(aa, bb) { let cc = [...bb]; for (let item in aa) { for (let it in cc) { if (aa[item] === cc[it]) { cc.splice(it, 1) } } } return cc.length < 1 ? true : false; }
let result = same(a, b); console.log(result); </script> </body> </html>
|