该循环应该获取每本书的价格,将其添加到总数中,然后将平均值放在每本书的页面上,直到用户输入“N”
<script type="text/javascript">
var ct = 1;
var yesORno = "Y";
while (yesORno = "Y"){
book = prompt("What is the price of book #" + ct, 0);
total = parseInt(book) + total;
ans = total / ct;
document.write("<p>With book #" + ct +" The average is " + ans + "</p>");
ct = ct + 1;
yesORno = prompt("Would you like to continue? (Y/N)", "")
}
</script>