首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >我想让用户把值放进去,然后在周末后用javascript在控制台中显示总数。

我想让用户把值放进去,然后在周末后用javascript在控制台中显示总数。
EN

Stack Overflow用户
提问于 2018-10-19 10:00:00
回答 2查看 45关注 0票数 -2

编写代码,询问用户一周内每天发送的信件数,并在控制台的javascript中显示一周内发送的信件总数

代码语言:javascript
复制
var day = 1;
var totalletters = 0; //total letters sent


for (day; day <= 7; day++) {
  var getletters = 0;
  getletters = prompt("Please enter the number of total letters sent today", );
  totalletters += getletters;
}

console.log(totalletters); //displaying the total number of letters sent at the end of the week

// The console is showing the output as string instead of adding up the numbers

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52884858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档