Garmaine Staff asked 1 year ago
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 5 hours ago.

Say I have something like the following:

const foo = {
  x: 0,
  y: 0,
  bar: () => {
    return foo.x;
  }
}

console.log(foo.bar());

But calling bar from foo will only return me the initial values that are set not the value if I update the object. Any suggestions?