Questions tagged «defineproperty»

10
如何使用javascript Object.defineProperty
我环顾四周如何使用该Object.defineProperty方法,但找不到任何合适的方法。 有人给了我这段代码: Object.defineProperty(player, "health", { get: function () { return 10 + ( player.level * 15 ); } }) 但是我不明白。主要是,这get是我无法得到的(双关语意)。它是如何工作的?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.