问题如下 ;
forEach循环添加多一个key
featuresCN.forEach(item=>{
item.href='超链接'
})
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
const featuresCN = [
{
title: "优雅美观",
},
{
title: "常见设计模式",
},
];
const hrefList = ["优雅美观href", "常见设计模式href"];
featuresCN.map((item, index) => {
item.href = hrefList[index];
});
console.log("featuresCN", featuresCN);
</script>
</body>
</html>