请帮忙。我只是这方面的新手。我一直在尝试用循环输出 2 组数组,但我似乎无法弄清楚。
这是我的代码:
<script>
cars=["BMW","Volvo","Saab","Ford"];
type=["Sports","Luxury","Premium","Economy"];
var i=0;
var a=0;
while (cars[i])
{
document.write(cars[i] + " - " + type[a]"<br/>");
i++;
}
</script>
我想要的结果是:
BMW - Sports
Volvo - Luxury
Saab - Premium
Ford - Economy
先感谢您!