title: Making an object property unchangeable through reassignment but modifiable in JavaScript
body: <pre><code>class Hero extends Character {
  constructor (name, race, gender, role, level){
      super(name, race, gender, role, level);
      this.inventory = [];
      this.experience = {
          experienceNeeded: 100,
          experienceObtained: 0
      };
      this.gold = 0;
  }
  </code></pre>
  
  <p>I have this class which defines how a player Character will be. I want to make both <code>experienceObtained</code> and <code>gold</code> properties unchangeable through reassignment but modifiable through operators to avoid users set their own values to these properties using console. </p>
  
  <pre><code>this.gold = {
          amount: 0,
          get gold(){
              return this.amount;
          }
      };
  </code></pre>
  
  <p>As showed above I tried using a getter without declaring a setter but I still can assign <code>amount</code> any value through console. </p>
  
  <p>I don't know if I am misunderstanding the use of getters and setters in JavaScript or if it is not possible to do.</p>