var command = 'OPEN'; switch (command) { case 'CLOSED': executeClosed(); break; case 'DENIED': executeDenied(); break; case 'OPEN': executeOpen(); break; default: executeUnknown(); }