My question is quite simple, if I declare an IF statement with a series of OR clauses, will JavaScript read all ORs or dwell on the first satisfying one?
Thanks in advance.
Stop the first. He called a short circuit
http://en.wikipedia.org/wiki/Short-circuit_evaluation https://developer.mozilla.org/en/JavaScript/Reference/Operators/Logical_Operators
It should only process the first OR, which returns true:
if (a || b || c) { }
If a is false, b is true, and c is true, it will process to b.
function foo() { return true; } function bar() { alert("bar"); } foo() || bar(); // true - no alert bar() || foo(); // true - alert of "bar"
, or
or
Source: https://habr.com/ru/post/1790444/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1790439/perl-m-operator-inexplicably-fails-to-match-a-simple-regex&usg=ALkJrhgvDp5Nvjot2svULkB0MddWgi75LQCSS column table, for example - htmlHow to simply make a sound or beep in wp7? - windows-phone-7Android copy image from gallery folder to alternative SD card folder - androidHow can I get the color at a specific coordinate in a pdf file - javaUserService.getCurrentUser () returns null - javaGetting IP address of broadcast source with boost :: asio - c ++Help install PMD plugin Eclipse - javaError installing PMD in eclipse - pmdПовторное использование IEnumerable приводит к ложному результату, например. on. Любой() - .netAll Articles