What is a Short circuit condition

Posted by Jessica Taylor | Updated on

Short circuit conditions are meant for condensed way of writing simple if statements. Let’s demonstrate the scenario using an example. If you would like to login to a portal with an authentication condition, the expression would be as below:

Since the javascript logical operators evaluated from left to right, the above expression can be simplified using && logical operator


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers