Struggling to use boolean expressions within a switch statement to search for undefined values and manually change them. When using an if statement, the process is easier.
For example: if statement
if(Item1 == undefined)
{
item1 = "No";
}
else if (Item2 == undefined)
{
item2 = "No";
}
But when attempting this with a 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:
}
The switch statement does not execute properly, except when removing == undefined
and just using item1
. Then it seems to work?