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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -