How to optimize switch statements traversing objects?

how to optimize switch statement traversal objects to be more concise

switch (this.active) {
    case 0:
      this.OrderState = "Wait";
      break;
    case 1:
      this.OrderState = "Sent";
      break;
    case 2:
      this.OrderState = "Fail";
      break;
    default:
      break;
}
Apr.01,2022


2019Map

let stateMap = new Map

stateMap
    .set(0, 'Wait')
    .set(1, 'Sent')
    .set(2, 'Fail')
    
this.OrderState = stateMap.get(this.active)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3106f-2bd77.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3106f-2bd77.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?