
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
// 皮球初始高度10米
var h = 10
// 对路程进行求和
var sum = 0
// 循环次数
for (n = 1; n <= 10; n++) {
// 每次路程为高度一半
h = h * 0.5
// 路程实际分为上下两次h需要乘以2
sum = sum + h * 2
}
// 最后最开始10米需要加
document.write(sum + 10)
</script>
</html>