I am using a switch statement to search for undefined values to manually change it. but I am having trouble using boolean expressions as I would when using an if statement.
Like: if statemant
if(Item1 == undefined)
{
item1 ="No";
}
else if (Item2 == undefined)
{
item2 = "No";
}
etc..
I tried this with the switch statement:
switch (array) {
case (item1 == undefined):
item1 = "No";
console.log('item1 result', item1 );
break;
case item2 == undefined:
item2 = "No";
console.log('item2 result', item2 );
break;
default:
}
It does not run through the switch statement, except for when I remove == undefined
and only use item1
. then it works?