An accessor property associates a key value with one or two accessor functions, and a set of Boolean attributes. The accessor functions are used to store or retrieve an ECMAScript language value that is associated with the property.
The above is from ecmascript specification 6th edition.
Since everything in javascript are objects, and all javascript properties are named data properties (Ndps) ( to the best of my knowledge ) ... And named accessor properties (Naps) as Getters and Setters are there more to Naps than getters and setters. And the retrieval of a Ndp does it come straight from the underneath js engine like v8 or there more about its implementation on the higher level?
Example code:
var stuff = { 'stuff1': 1, 'stuff2': 2 } // stuff as an Object
stuff.stuff1 // returns 1
Object.defineProperty(stuff, 'stuff3', {
// defining stuff3's property attributes
get: function() { return 'Hey! This is from the getter function'}
enumerable: true,
configurable: true
})
stuff.stuff1 // returns but how does it
stuff.stuff3 // returns and i know how because it was defined.
Is there any other implementation of stuff
's operation?
Please other reference materials or links should be noted.
var stuff = { 'stuff1': 1, 'stuff2': 2 }
is equivalent toObject {stuff1: 1, stuff2: 2}
sostuff.stuff1
should return something.