const obj = {
foot: [1, 3, 5],
shoe: [7, 9, 11],
dump: // a function that sets obj.dump as the value of (this.foot[1] + this.shoe[0])
// (otherwise known as `10`)
}
Things I have tried (IIFE
, anon function, etc), referring to obj.dump
returns the function used to do the add.
I would like obj.dump
to instead return 10
What is the proper syntax for that?
Side note, how would I search for this? What could this pattern be called?