I want to run this if statement .
Help me to get the value of a.
var a =undefined ;
if(a=1 && a=2 && a=3)
{
console.log("Hello")}
else
{console.log("Error")
}
I want to run this if statement .
Help me to get the value of a.
var a =undefined ;
if(a=1 && a=2 && a=3)
{
console.log("Hello")}
else
{console.log("Error")
}
The issue is with this line if(a=1 && a=2 && a=3)
.Here the value is getting set to a instead of checking the condition
var a = undefined;
if (a === 1 && a === 2 && a === 3) {
console.log("Hello")
} else {
console.log("Error")
}
i want to run this if statement
a cannot be 1,2,3 at same time unless you are looking for something like this.Otherwise you can use or operator ||
instead of &&