JS - Using switch instead of ifelse for heaps possibilities

0 votes
186 views
added Mar 6, 2019 in Javascript by LC Marshal Captain (25,790 points)
let PropertyType = ColumnMainData.result.field_property_type.und['1'].target_id;
switch (PropertyType) {
    case '34':
      PropertyType = 'Condominium / Apartment / Serviced Residence';
      break;
    case '35':
      PropertyType = 'Flat';
      break;
    case '38':
      PropertyType = 'Link Bungalow / Semi-Detached House';
    // default:
    // PropertyType = 'null';
}

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...