I'm a bit confused
While it's always mentioned that encapsulation allows us to not expose variables to outer world and we can have setter and getter functions in order to have access, does it really help with avoiding to directly set the value of an object property ?
I mean what's the idea in having a setter and a getter function if one can easily change the property with object.name=***** this kind of syntax?
What is the real idea behind encapsulation ?
Thanks ?