Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. // conditional operand selectors
  2. let log = console.log;
  3. // log(true && true); // true
  4. // log(false && true); // false
  5. // log(true || false); // true
  6. // log(false || true); // true
  7.  
  8. // log(0 && true); //0 - && looks at the first and if it is truthy renders the second
  9. // log(1 && true); //true
  10. // log(0 || false); // false
  11. // log(1 || true); // 1
  12.  
  13. // log(0 && "text"); // 0
  14. // log(1 && "text"); // text
  15. // log(0 || "text"); // text
  16. // log(1 || "text"); // 1
  17.  
  18. log(false && "text"); //false
  19. log(true && "text"); //text
  20. log(false || "text"); // text
  21. log(true || "text"); // true
  22.  
  23. //react will render the following primitives
  24. // 0, 1, Null, Strings, NaN
  25. //react will not render
  26. // booleans, undefined, null, empty strings, empty arrays | objects
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement