The juxtaposition of conditions?

if(condition == "con1" || condition == "con2")

cannot be written as

if(condition == "con1" || "con2")

?

Mar.01,2021

No, this problem is designed to JS operator priority.

if(condition == "con1" || condition == "con2")

is equivalent to:

if((condition == "con1") || (condition == "con2"))

and if (condition = = "con1" | | "con2")

is equivalent to:

if((condition == "con1") || "con2")


"con1" | | "con2": "con1" is a string, equivalent to true, so "con1" | | "con2" = = "con1"
if (condition = = "con1" | | "con2") you just judged condition = = "con1"


No, priority question
is equivalent to

if((condition == "con1") || ("con2"))

you can't be the first to return con2 after false, and then true forever.
write your own filter

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea9059-47d04.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea9059-47d04.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?