Reputation: 409
I wonder if the react native can read the ||
operator in the condition. I'm trying to do some data filtering in my app where either one of the data is true and so I used the ||
operator. But then, my app seems not be able to read it.
Example :
if(this.state.open_intro == false || this.state.intro.length < 0){
// do some statement at here
} else {
// do some statement at here
}
My this.state.open_intro
is false
and the value of this.state.intro.length
is more than 0 though. So it supposed to read the else statement, but it always read the first statement.
Upvotes: 2
Views: 7115
Reputation: 86
a=1; b=2;
if(a == 10 || b == 1)
{ This is correct logic }
else
{ This is incorrect logic };
Upvotes: 0