LLD - Behavioral Design Patterns — Part 1
In the following code, what is the main issue that prevents the Command pattern from working correctly?
class Light {
turnOn() { console.log('Light is ON'); }
}
class TurnOnCommand {
constructor() { }
execute() { this.light.turnOn(); }
}
const light = new Light();
const command = new TurnOnCommand();
command.execute();