I'm looking for the method that Object
or Array
use internally when executing:
var x = { a: 1 }
// getters
x['a'] // or x.a
// setters
x['a'] = 1 // or x.a = 1
Same for arrays
var a = [0, 1]
// getter
a[0]
// setter
a[0] = 1
I'm looking for the method that Object
or Array
use internally when executing:
var x = { a: 1 }
// getters
x['a'] // or x.a
// setters
x['a'] = 1 // or x.a = 1
Same for arrays
var a = [0, 1]
// getter
a[0]
// setter
a[0] = 1
Well, you have two alternatives:
defineProperty
contains "set" and "get" attributes. You could apply this thing for every property that you need to be declared.