this.work[0].minValue = await this.getData().then(
value => value[0].set.min.X
)
this.work[1].minValue = await this.getData().then(
value => value[0].set.min.Y
)
this.work[2].minValue = await this.getData().then(
value => value[0].set.min.Z
)
this.work[3].minValue = await this.getData().then(
value => value[0].set.min.A
)
this.work[4].minValue = await this.getData().then(
value => value[0].set.min.B
)
this.work[5].minValue = await this.getData().then(
value => value[0].set.min.C
)
I am trying to write this 6 lines of code inside a loop, which i am not able to do it. Could someone help me out.
var arr = ['X', 'Y', 'Z', 'A', 'B', 'C']
var i = 0
var that = this
this.work.forEach(item => {
item.minValue = that.getData().then(value => value[0].set.min.that.arr[i])
i++
})
i know this is wrong with min.that.arr[i].Please dont say its reason why it not working, Please help me out with the solution.