In the example below, i get the same results if i log “_key1” directly, or if i log it through the getter.
Why do I need the getter for? is it only for privacy of the key?
const object {
_key1: value1,
_key2: value2,
get key1 () {
return this._key1
};
console.log(object._key1);
console.log(object.key1);