posts - 19 , comments - 8 , trackbacks - 0

My Links

News

Archives

Post Categories

Image Galleries

June 2015 Entries

JavaScript Properties
Overview The following code demonstrates how to use prototype base getters and setters in JavaScript. function Colour(red, green, blue, alpha) { this.value = [red, green, blue, alpha]; } Object.defineProperty(Colou... "red", { get: function () { return this.value[0]; }, set: function (x) { this.value[0] = x; } }); Object.defineProperty(Colou... "green", { get: function () { return this.value[1]; }, set: function (x) { this.value[1] = x; } }); Object.defineProperty(Colou... ......

Posted On Wednesday, June 10, 2015 9:21 AM | Comments (0) | Filed Under [ JavaScript Property Properties get set getters setters ]

Powered by: