What is the meaning of sign || in javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the meaning of sign || in javascript?

13th Sep 2020, 4:52 AM
Raunak Goyal
2 Answers
+ 2
The sign "||" means OR. Similiar to AND "&&". Example: if (a || b) { // code } This code will run if a or b are true.
13th Sep 2020, 5:03 AM
coddy
coddy - avatar
+ 2
It's a sign for *OR* It is used when you want atleast 1 condition as true to run the program a=1 b=2 a==1||b==1 If you set this condition then your program will be executed because one of the two conditions is true
13th Sep 2020, 5:03 AM
OfcourseitsRohit
OfcourseitsRohit - avatar