Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. if (checkPassword() == true || checkUserName() == true)
  2. event.preventDefault();
  3.  
  4. if ([checkPassword(), checkUserName()].some(Boolean)) {
  5. // ...
  6. }
  7.  
  8. // checkPassword and checkUserName have side effects, both need to be run
  9. const invalidPassword = checkPassword()
  10. const invalidUserName = checkUserName()
  11.  
  12. if (invalidPassword || invalidUserName) {
  13. ...
  14. }
  15.  
  16. 0 0 | 0
  17. 0 1 | 1
  18. 1 0 | 1
  19. 1 1 | 1
  20.  
  21. 0 0 | 0
  22. 0 1 | 0
  23. 1 0 | 0
  24. 1 1 | 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement