javascript - getting message condition is always true -
i'm getting message resharper condition true following code
if (filters == "answers" || "solution") { }
what's happening here in code?
if (filters == "answers" || "solution") { }
in above code "solution" true
so, change
if (filters == "answers" || filters =="solution") { }
example
if("i") { }
above true always.
so, in code second condition returns true
as per boolean or , [anything true] true
you have 2 predicates , truth table
i/p o/p true false true false ture true false false false true true true
in code, never condition #1 , #3 so, true
so code true
Comments
Post a Comment