Today i  am talking about javascript getter and getter.
Js Setter and getter using for highly manupulate javascript object value. We can calculate js object value using this two things.
class Thermostat {
    constructor(fahrenheit) {
      this.fahrenheit = fahrenheit;
    }
    get temperature() {
      return (5 / 9) * (this.fahrenheit - 32);
    }
    set temperature(celsius) {
      this.fahrenheit = (celsius * 9.0) / 5 + 32;
    }
  }
    
Top comments (0)