我在计算 javascript 中的平方和时遇到问题。当我定义 for 循环和变量索引时,我迷路了。谁能帮我理解我做错了什么?
var sums = [];
var sumsqs= Number(prompt("Please enter a number to sum the square"));
for (var index = 0; index < sumsqs.length; index++) {
var total = total + sumsqs[index] * sumsqs[index];
document.write("<h1>The sum of squares is " + total + ".</h1>");
谢谢你,维