Writing Clean & Maintainable Code

What's the benefit of implementing the Command Pattern in JavaScript applications?
class Command {
  execute() {}
  undo() {}
}

class AddUserCommand extends Command {
  constructor(receiver, userData) {
    super();
    this.receiver = receiver;
    this.userData = userData;
  }

  execute() {
    this.receiver.addUser(this.userData);
  }

  undo() {
    this.receiver.removeUser(this.userData.id);
  }
}
Next Question (18/20)