<!DOCTYPE html>
<html lang="en">
<html lang="en">
<head>
<meta charset="UTF-8">
<title>map 数组</title>
</head>
<meta charset="UTF-8">
<title>map 数组</title>
</head>
<body>
<script>
var data = [1, 2, 3, 4, 5];
var arr = data.map(function(val) {
//数组中幂的运算
return Math.pow(val, 3)
});
document.write(arr)
document.write("<br/>")
var qq = ['A', 'B', 'C', 'D']
var zzz = qq.map(function(val) {
//数组中的大写换小写
return val.toLocaleLowerCase()
})
document.write(zzz)
<script>
var data = [1, 2, 3, 4, 5];
var arr = data.map(function(val) {
//数组中幂的运算
return Math.pow(val, 3)
});
document.write(arr)
document.write("<br/>")
var qq = ['A', 'B', 'C', 'D']
var zzz = qq.map(function(val) {
//数组中的大写换小写
return val.toLocaleLowerCase()
})
document.write(zzz)
</script>
</body>
</body>