Advertisement
straznik_graniczny

many conditions in js

Oct 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var a = 0;
  2. var b = 0;
  3.  
  4. a += ("condition 1")? 1 : 0; b += 1;
  5. a += ("condition 2")? 1 : 0; b += 1;
  6. a += ("condition 3")? 1 : 0; b += 1;
  7. a += ("condition 4")? 1 : 0; b += 1;
  8. a += ("condition 5")? 1 : 0; b += 1;
  9. a += ("condition 6")? 1 : 0; b += 1;
  10. // etc etc
  11.  
  12. if(a == b) {
  13.     //do stuff
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement