How does javascript logical assignment work?
For your q || a to evaluate to a, q should be a ‘falsy’ value. What you did is called “Short circuit evaluation”. Answering your questions: The logical operators (like and – &&, or – ||) can be used in other situations too. More generally in conditional statements like if. More here Empty string is … Read more