title: Are `getter` and `setter` necessary in JavaScript?
body: <pre><code>class Employee {
  
      constructor(name, age) {
          this._name = name;
          this.age = age;
      }
  
      doWork() {
          return `${this._name} is working`;
      }
  
      get name() {
          return this._name.toUpperCase();
      }
  
      set name(newName){
          if(newName){ 
              this._name = newName;
          }
      }
  }
  
  let man = new Employee('A', 10);
  console.log(man.name, man.age);
  man.name = 'B';
  man.age = 20;
  console.log(man.name, man.age);
  </code></pre>
  
  <p>Here is my code. I created a <code>getter</code> and <code>setter</code> for <code>_name</code> member. I did not create a <code>getter</code> and <code>setter</code> for <code>age</code>.</p>
  
  <p>But both can update these two fields like this <code>man.name = 'B';man.age = 20;</code></p>
  
  <p>So I am confused, are <code>getter</code> and <code>setter</code> necessary in JavaScript?</p>