Solution 1 :

let response = JSON.parse(*YourResponse*).locality;
if(response === ""){
    response = "SELECT";
}
element.innerHTML +=  response;

You can also use ternary operator in place of if.

Problem :

Api response is given below

[
 {
        "productId": 928,
        "hotelId": 0,
        "productName": "Loc 5",
        "country": "India",
        "city": "Bangalore",
        "locality": "",
        "availableRooms": 0,
        "availableRateplans": 0,
        "status": false,
        "hexStatus": false,
        "additionalProperties": {}
    }
]

By