What's the easiest way to track changes to an object or variable?

  • 0
    There is a global variable in which the object is located. Changes are made to the object from time to time. Can you please tell me what is the easiest way to track the fact that an object has changed? Are there any analogs for addEventListener () that could be applied to variables?

    Initially, I thought it would be banal to check the variable head-on in a loop through setInterval () , but it seems to me that there should be more efficient solutions, I would not want to reinvent the wheel.
    JavaScript Connor Gilbert, Aug 15, 2019

  • 3 Answers
  • 0
    I won't be smart, I haven't done it myself, although I've been programming for a long time.

    You need this
    Anonymous

  • 0
    You can via Proxy
    Anonymous

  • 0
    You need to connect either a global storage such as redax, mobix, etc. or write your own, if you need your own bike.

    Look towards reactive programming
    Adeline Sanders

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!