我正在尝试使用传递给函数的数字来定位我拥有的许多不同变量。变量是button1,button2,button3等。我将数字作为参数传递,但不确定如何用数字替换变量。
function madRunner(number) {
// ie ideally I can add in the number instead of 3!
Button3Value = parseInt(e.target.price);
// I was thinking something like this??
`Button${number}Value` = parseInt(e.target.price);
}