js各种for循环的效率问题
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> </style> </head> <body> <script> let newarr = new Array(100000) let myfor = [] let myforin = [] let myforeach = [] let myforof = [] let mymap = [] let myfind = [] let myfilter = [] let mywhile = [] let mysome = [] let myevery = [] console.time("forin"); for(x in newarr){ myforin.push(x) } console.timeEnd("forin") console.time("for"); for(let i=0;i<newarr.length;i++){ myfor.push