OOP air conditioner model
I don't know the position you were interviewed for. Below is the embedded engineer point of view.


A room temp is not a class parameter. The AC cannot control it directly, so this.temperature++ and this.temperature-- are incorrect. The AC may only read the temp sensor.
The desired temperature OTOH is a class parameter. You should go an extra mile and provide the interface to set it. BTW, I'd expect temperatureSet to do just that: set the desired temperature.
As implemented, the program terminates as soon as a certain temperature is reached. I expect an AC system to run more or less forever.
In the if (this.temperature &lt; temperature) clause you turn on heater no matter what. Move the this.heatingSystem = true; line outside of this.coolingSystem clause.


Assuming the above recommendations are implemented, the basic functionality should look like this:

    while(true) {
        ambientTemperature = this.temperatureSensor.read();
        if (ambientTemperature &lt; this.targetTemperature) {
            if (this.coolingSystem) {
                this.coolingSystem = false;
            } else {
                console.log('Temperature has been lowered to ' + ambientTemperature);
            }
            this.heatingSystem = true;
        } else {
        ....


Of course there is a plenty of room to improve, but again that depends on interviewer expectations, and the AC schematics you'd agree upon.