Hello i have an array of objects. Like this:
const obj = [{
   count: 10,
   value: count*2 // the previous count
}]
How can i reference 'count' on 'value' without having to find the index, or is a way to find the index of 'obj'?
Hello i have an array of objects. Like this:
const obj = [{
   count: 10,
   value: count*2 // the previous count
}]
How can i reference 'count' on 'value' without having to find the index, or is a way to find the index of 'obj'?
 
    
    You could take a getter with a reference to the same object.
const
    objects = [{
        count: 10,
        get value () { return this.count * 2; }
    }];
console.log(objects[0].value);