Track whether object changed

前端 未结 5 461
感情败类
感情败类 2021-01-12 23:33
// A simple Javascript Object / String
var object = \"hello\";

// Imagine a button in the DOM, and if it\'s clicked the object value will change
document.getElement         


        
5条回答
  •  醉话见心
    2021-01-13 00:18

    You can track a JavaScript object by using Getters and Setters as described here,

    http://ejohn.org/blog/javascript-getters-and-setters/

    You can also look at,

    Javascript getters and setters for dummies?

提交回复
热议问题