<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> body { font-family: "Microsoft YaHei", serif; } body, dl, dd, p, h1, h2, h3, h4, h5, h6 { margin: 0; } ol, ul, li { margin: 0; padding: 0; list-style: none; } img { border: none } </style> </head> <body> <script> // 遍历数组,可以返回一个数组 // 这个和6是一样的 // 就是多一个返回值 let a = [1,2,4]; let b = a.map(function (x,y,z) { console.log(x, y, z); return x*x }); console.log(a); console.log(b); </script> </body> </html>