<!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>
<div id="wrap"></div>
<script>
//map可以有返回值
// forEach不能有返回值,没有意义
//map可以返回每一个的平方
let arr = [1,2,3,4,5];
let x = arr.map(function (ele,i) {
return ele*ele
});
console.log(x);
console.log(arr);
</script>
</body>
</html>
Python3Turtle