質問編集履歴

1

変数名を修正

2022/06/22 11:53

投稿

K_Chi
K_Chi

スコア11

test CHANGED
File without changes
test CHANGED
@@ -21,17 +21,17 @@
21
21
  ```
22
22
  ```JavaScript
23
23
  window.addEventListener('load', function(){
24
- const $cost = document.getElementById("asset-retirement-cost");
24
+ const cost = document.getElementById("asset-retirement-cost");
25
- const $year = document.getElementById("year-of-use");
25
+ const year = document.getElementById("year-of-use");
26
- const $interest = document.getElementById("interest");
26
+ const interest = document.getElementById("interest");
27
- const $button = document.getElementById("button");
27
+ const button = document.getElementById("button");
28
- const $presentValue = document.getElementById("present-value");
28
+ const presentValue = document.getElementById("present-value");
29
29
 
30
- $button.addEventListener('click', function() {
30
+ button.addEventListener('click', function() {
31
- const inputCost = $cost.value;
31
+ const inputCost = cost.value;
32
- const inputYear = $year.value;
32
+ const inputYear = year.value;
33
- // const interest = $interest.value;
33
+ const inputInterest = interest.value;
34
- $presentValue.innerHTML = Math.floor(inputCost/((++$interest.value)**inputYear)).toLocaleString();
34
+ presentValue.innerHTML = Math.floor(inputCost/((++inputInterest.value)**inputYear)).toLocaleString();
35
35
  })
36
36
  });
37
37
  ```