Why are methods like setters used, instead of changing properties directly in Javascript? <p>With an object defined.</p> <pre><code>var bob = {age: 10}; </code></pre> <p>Defined setter as:</p> <pre><code>bob.setAge = function (newAge){ bob.age = newAge; }; </code></pre> <p>So we can change a property as:</p> <pre><code>bob.setAge(20) </code></pre> <p>Instead of simply:</p> <pre><code>bob.age = 20; </code></pre> <p>or</p> <pre><code>bob["age"] = 20; </code></pre> <p>Is best practices the reason?</p>