I am a backend developer that has developed mostly in Java so I was taught to use setters/getters instead of directly accessing the properties of a class.
Now I'm getting into the frontend world and now got to js/ts. I've seen lot of people access object variables directly without setters and getters as you'd do in Java such as this.person.name.
Why is this? Is there any advantage on using getter/setter on ts and js if you don't need to add extra code but just to get the value or set it?
Thanks.
