I have an array something like this:
let arr = [
{
num: 10,
reload: () => {
this.num = 30;
}
},
{
num: 40,
reload: () => {
this.num = 20;
}
}
]
then I am trying to run this code
arr.forEach(item => {
item.reload()
})
I want the array's first object to have num
= 30 and second one as num = 20
this
doesn't seen to work..