Javascript Enum Question

Hey Guys, Making a simple Javascript inventory class and just have a quick question

{
		var ItemName : String;
		var ItemId : Int;
		var ItemIcon : Texture; //the 2D image of it for inventory use basically
		var ItemType : itemtype; //referencing the enum created below





}



//enum(s)
//basically an enum makes an array of the possible values an item could have
enum itemtype = {weapon, food, potion, misc, material, tool}

I was thinking about adding a conditional set of values in the class to it, like lets say are only values if the enum itemtype is set to ‘weapon’

Would it be as easy as saying
if (ItemType === weapon)
{ var ItemMaterail : String}

Any advice would be amazing!

enum ITEM_TYPE = {weapon, food, potion, misc, material, tool}
private var itemType : ITEM_TYPE;

if(itemType == ITEM_TYPE.weapon){

}

if you need a lot of checks id suggest using switch case tree.

switch(itemType){
    case ITEM_TYPE.weapon:
     //do something with weapon
    break;
    case ITEM_TYPE.food:
     //do something with food
    break;
}