Short-circuiting in JavaScript

Short circuit: Logical operations run from left to right. Logical OR operation, when the condition on the left is true, the following conditions will no longer participate in the operation.

Therefore, in the logical OR operation, try to put the conditional result as true first. In the logical AND operation, try to put the conditional result as false in the first place.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324767799&siteId=291194637