I am exploring ways to update variables dynamically in order to avoid using excessive switch statements. My initial approach was:
this.variable1 = 2
this.variable2 = 3
var array1 = [this.variable1, this.variable2]
And then later on:
array1[0] = 25
array1[1] = 12
console.log(array1[0]) //would output 25
console.log(array1[1]) // would output 12
Unfortunately, this is not the outcome that occurs, which is expected. But I am curious about how I can achieve dynamic variable updates. There must be a way, and I am determined to find it.