Let's say I have an object that contains a string and a function that does something with that string. But I want that string to remain private.
let object = {
someData: 'test', // this is public
modifyData: function() {
return this.someData + ' needs to be private';
}
}
I want to have the property someData private from outside but accesible for the method modifyData (or further new methods if added at some point).