尝试在新数组中分配数组值会产生错误。有人可以帮忙解决它为什么会出错吗?
<html>
<head>
<style>
</style>
</head>
<body>
<script>
var a=["red","yellow","pink","blue","aqua"];
var b=["rose","lotus","sunflower","lily","mogra"];
var c=["mango","banana","orange","blueberry","lichi"];
console.log(a[1]);
console.log(b[2]);
console.log(c[3]);
var d=[a[l],b[2],c[3]];
console.log(d);
</script>
</body>
</html>
&#13;
答案 0 :(得分:2)
你在这一行写了'l'而不是'1':
var d = [a [l],b [2],c [3]];
修正如下:
<html>
<head>
<style>
</style>
</head>
<body>
<script>
var a=["red","yellow","pink","blue","aqua"];
var b=["rose","lotus","sunflower","lily","mogra"];
var c=["mango","banana","orange","blueberry","lichi"];
console.log(a[1]);
console.log(b[2]);
console.log(c[3]);
var d=[a[1],b[2],c[3]];
console.log(d);
</script>
</body>
</html>