React - switch

0 votes
130 views
added May 16, 2019 in React by LC Marshal Captain (25,770 points)
const queryvar = '&propertyType=';
switch ((queryresult.toLowerCase())) {
    case 'non-landed':
    queryPropertyType = `${queryvar}r-33`;
    return queryPropertyType;
    case 'condominium': case 'apartment': case 'service residence':
    queryPropertyType = `${queryvar}r-34`;
    return queryPropertyType;
    case 'flat':
    queryPropertyType = `${queryvar}r-35`;
    return queryPropertyType;
    case 'landed':
    queryPropertyType = `${queryvar}l-36`;
    return queryPropertyType;
    case 'bungalow': case 'detached house': case 'villa':
    queryPropertyType = `${queryvar}l-37`;
    return queryPropertyType;
    case 'link bungalow': case 'semi-detached house':
    queryPropertyType = `${queryvar}l-38`;
    return queryPropertyType;
    case 'terrace house':
    queryPropertyType = `${queryvar}l-39`;
    return queryPropertyType;
    case 'town house':
    queryPropertyType = `${queryvar}l-40`;
    return queryPropertyType;
    case 'cluster house':
    queryPropertyType = `${queryvar}l-41`;
    return queryPropertyType;
    case 'low-cost house':
    queryPropertyType = `${queryvar}l-42`;
    return queryPropertyType;
    case 'residential land':
    queryPropertyType = `${queryvar}l-43`;
    return queryPropertyType;
    case 'house (others)':
    queryPropertyType = `${queryvar}l-44`;
    return queryPropertyType;
    case 'commercial':
    queryPropertyType = `${queryvar}c-60`;
    return queryPropertyType;
    case 'office':
    queryPropertyType = `${queryvar}c-61`;
    return queryPropertyType;
    case 'shop':
    queryPropertyType = `${queryvar}c-62`;
    return queryPropertyType;
    case 'shop house':
    queryPropertyType = `${queryvar}c-63`;
    return queryPropertyType;
    case 'hotel/leisure':
    queryPropertyType = `${queryvar}c-64`;
    return queryPropertyType;
    case 'commercial complex':
    queryPropertyType = `${queryvar}c-65`;
    return queryPropertyType;
    case 'commercial house':
    queryPropertyType = `${queryvar}c-66`;
    return queryPropertyType;
    case 'commercial land':
    queryPropertyType = `${queryvar}c-67`;
    return queryPropertyType;
    case 'commercial (others)':
    queryPropertyType = `${queryvar}c-68`;
    return queryPropertyType;
    case 'agricultural land':
    queryPropertyType = `${queryvar}c-69`;
    return queryPropertyType;
    case 'industrial':
    queryPropertyType = `${queryvar}i-70`;
    return queryPropertyType;
    case 'factory/warehouse':
    queryPropertyType = `${queryvar}i-71`;
    return queryPropertyType;
    case 'industrial land':
    queryPropertyType = `${queryvar}i-72`;
    return queryPropertyType;
    case 'industrial (others)':
    queryPropertyType = `${queryvar}i-73`;
    return queryPropertyType;
    default:
    return null;
}

 

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