JSFiddle - React, Tailwind, and code Playground

by Pratik Bhonsle

JavaScript

var PlaceType = {
    PASSABLE_TERRAIN: 1,
    IMPASSABLE_TERRAIN: 0,
    SOMEWHAT_PASSABLE_TERRAIN: 2,
    PATH: 3
};

function setPlaceType(placeType) {
    this.clear = false;
    this.placeType = parseInt(placeType, 10);

    alert("before switch " + (PlaceType.SOMEWHAT_PASSABLE_TERRAIN === this.placeType));
    switch (this.placeType) {
    case PlaceType.PASSABLE_TERRAIN:
        alert("Case PASSABLE");
        break;
    case PlaceType.IMPASSABLE_TERRAIN:
        alert("Case IMPASSABLE");
        break;
    case PlaceType.SOMEWHAT_PASSABLE_TERRAIN:
        alert("Case SOMEWHAT_PASSABLE");
        break;
    case PlaceType.PATH:
        alert("Case PATH");
        break;
    default:
        alert("case default");
    }
}
setPlaceType(2);