// 循環使用同一對象 function withValue(value) { var d = withValue.d || ( withValue.d = { enumerable: false, writable: false, configurable: false, value: null } ); d.value = value; return d; } // ... 并且 ... Object.defineProperty(obj, "key", withValue("static"));
Object.defineProperty中這段代碼如何理解?實際中有用的上的地方嗎?在哪使用?
繁花如伊
2018-09-07 14:16:16
