<!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>
</head>
<body>
<script>
var arr = [{
name : "张三",
age : '132',
},{
name : "张三1",
age : '13222',
}]
var arr1 = [
{
play : "打球",
eat:"吃饭"
},
{
play : "打球1",
eat:"吃饭2"
}
]
obj = arr.map((item,index) => {
return {...item, ...arr1[index]};
});
console.log('item',obj)
</script>
</body>
</html>
网友评论