title: Access Class Variable
body: <p>I want to access a class variable.but assign data in a constructor.
  EX:</p>
  
  <pre><code>class Student {
      constructor(data) {
         this.data = data;
         this.extraVariable = "Value"
      }
  
      getData() {
         return this.data
      }
  }
  
  var s = new Student({name: 'Abcd', subject: 'Javascript'});
  
  s.name = 'Xyz';  // i want to access name using s.name not s.data.name
  
  // i want to get updated data by calling this
  s.getData() // it return { name: 'Xyz', subject: 'Javascript' }
  </code></pre>
  
  <p>in this class assign data in constructor or setData Method but I want to access those data by directly without this.data.variableName. and I want to get only those data, not other class variables when I called getData method</p>
  
  <p><strong>NOTE: the member should not fixed like name and subject. if i want to add more members the i don't want tocreate getName and setName methods because members are not fixed</strong></p>