欢迎吐槽! 用户输入任意一个三位数,获得这三个数的各个位数加和并打印 菜鸟答案: var a=Number(prompt("请输入一个三位数")) var b=Math.floor(a/100) var c=Math.floor(a/10) %10 var d=a %10 alert(b+c+d)