Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. //Logical Operators
  2.  
  3. //AND and OR
  4.  
  5. console.log(1 === 1 && 2 === 2); // returns true
  6.  
  7. //the above says that if 1 = 1 AND 2 = 2, then return true
  8. //ALL statements seperated by AND (&&) must be true for the statement to be true as a whole
  9.  
  10. console.log(1 === 1 || 2 < 1); // returns true
  11.  
  12. //the above says that if 1 = 1 OR 2 < 1 return true. Only ONE statement seperated by OR (||)
  13. //needs to be true
  14. //to return true
  15.  
  16. //Not True
  17.  
  18. console.log(! 1 === 1);
  19.  
  20. // The not (!) operator returns the opposite of whatever
  21. //the boolean would have been.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement