I have an array with numbers and objects, for example:
var array = [0,0,1,0,2, {type:player, health:100, xp: 0}, 0,2,1,0, {type:weapon, damage:20}]
Then I loop through the array and set a string in a variable that I use to dynamically set classes.
For now I have the following loop with switch statement:
for(var i = 0; i < array.length; i++){
        var setClass = "";
        switch (array[i]) {
          case 1:
            setClass = "walkable";
            break;
          case 2:
            setClass = "wall";
            break;
          default:
            setClass = "outside"
        }
}
What I want to do is in the switch statement check if the item in the loop is 1) an object and 2) with a certain key/value pair?. So I would like to set the string to something for type:player and something else for type:weapon. How can I do that?
 
     
     
    