In every JavaScript tutorial that I have looked there is something mentioned about a property of an object. But why do they call it a property? e.g. constructor property, var a = function{this.b} where b is again called property. As far as I know properties have getter and/or setter, so those one should be called field, shouldn’t they?
In every JavaScript tutorial that I have looked there is something mentioned about a
Share
Some browser vendor have implemented getters/setters for JavaScript properties.
FF and Webkit has
__defineGetter__and__defineSetter__implemented for DOM objects and get and set for Object’s which is outside of the ECMA specification. However both and also IE 8+ has theObject.defineProperty(from the ECMA specification). Read about it hereAs for you original question, I would say that the reason it’s called property in JavaScript is that it’s a dynamic language and the basic markup uses only properties and local var’s. Since everything is bound to a specific scope-hierarchy all you have is different tree-branches on each level. And Douglas Croockford named them properties 🙂