File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
1-js/02-first-steps/11-logical-operators/8-if-question Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 1- The answer: the first and the third will execute .
1+ Atsakymas: pirma ir antra bus įvykdytos .
22
33Details:
44
55``` js run
6- // Runs .
7- // The result of -1 || 0 = -1, truthy
8- if (- 1 || 0 ) alert ( ' first ' );
6+ // Paleidžiama .
7+ // Rezultatas iš -1 || 0 = -1, truthy
8+ if (- 1 || 0 ) alert ( ' pirmas ' );
99
10- // Doesn't run
10+ // Nepaleidžiamas
1111// -1 && 0 = 0, falsy
12- if (- 1 && 0 ) alert ( ' second ' );
12+ if (- 1 && 0 ) alert ( ' antras ' );
1313
14- // Executes
15- // Operator && has a higher precedence than ||
16- // so -1 && 1 executes first, giving us the chain :
14+ // Įvykdomas
15+ // Operatorius && turi aukštesnį prioritetą negu ||
16+ // tad -1 && 1 įvykdomas pirmiau, sukurdamas mums grandinę :
1717// null || -1 && 1 -> null || 1 -> 1
18- if (null || - 1 && 1 ) alert ( ' third ' );
18+ if (null || - 1 && 1 ) alert ( ' trečias ' );
1919```
2020
You can’t perform that action at this time.
0 commit comments