这是我的代码。
var products = ["Echo Dot", "Echo Plus", "Echo Auto", "Echo Show", "Echo Link"];
var prices = [49.99, 69.99, 129.99, 229.99, 1099.99];
toDisplay = "";
total = 0;
for (var i = 0; i < products.length; i++) {
toDisplay += "<li>" + products[i] + " - " + prices[i] + "</li>";
total += prices[i];
}
document.getElementById('prices').innerHTML = toDisplay;
<ol id="prices">
</ol>
慕侠2389804
手掌心
相关分类