0

why got it this result in decrement var? javascript

this result it would be 12 not 11 . I dont undersand it var a = 10; var b = 11; var c; if (a++ >= 10 || b++ >= 11) { console.log(b); } //output 11 Does it evaluate the first conditional and not go through the second? by the operator || since el first condicional it is true ???

22nd Mar 2020, 7:28 AM
MetaCop
MetaCop - avatar
2 odpowiedzi
+ 7
Carlos Alfonso Terrazas Valencia you guessed it right. If the first condition is true then the second one is ignored because OR returns true even if one condition is true.
22nd Mar 2020, 7:31 AM
Avinesh
Avinesh - avatar
+ 2
@Avinesh Thanks!
22nd Mar 2020, 8:23 AM
MetaCop
MetaCop - avatar