有沒有辦法循環變量的聲明?只是一個循環來幫我聲明變量,所以我不必須做改變單調的工作變量有沒有辦法循環這個?
\t var height1 = document.getElementById('height1').value;
\t var height2 = document.getElementById('height2').value;
\t var height3 = document.getElementById('height3').value;
\t var height4 = document.getElementById('height4').value;
\t var height5 = document.getElementById('height5').value;
\t var height6 = document.getElementById('height6').value;
\t var height7 = document.getElementById('height7').value;
\t var height8 = document.getElementById('height8').value;
\t var height9 = document.getElementById('height9').value;
\t var height10 = document.getElementById('height10').value;
\t var height11 = document.getElementById('height11').value;
\t var height12 = document.getElementById('height12').value;
\t var height13 = document.getElementById('height13').value;
\t var height14 = document.getElementById('height14').value;
\t var height15 = document.getElementById('height15').value;
\t var height16 = document.getElementById('height16').value;
不是一個聲明,但你可以把這些變量放在一個數組或其他東西。爲什麼你需要所有這些個人價值?這聽起來有點像[XY問題。](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) –
我從表中獲取這些值,客戶將放入維度,然後生病使用這些生成價格報價 – PortaDoor