码迷,mamicode.com
首页 > 其他好文 > 详细

Logical Operators

时间:2019-01-01 23:57:10      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:empty   can   sea   val   ISE   operator   script   null   define   

Logical Operators

Operator Description Useage
Logical AND (&&) expr1 && expr2 Returns expr1 if it can be converted to false; otherwise, returns expr2. Thus, when used with Boolean values, && returns true if both operands are true; otherwise, returns false.
Logical OR (||) expr1 || expr2 Returns expr1 if it can be converted to true; otherwise, returns expr2. Thus, when used with Boolean values, || returns true if either operand is true.
Logical NOT (!) !expr Returns false if its single operand can be converted to true; otherwise, returns true.

Falsy

  • null;
  • NaN;
  • 0;
  • empty string ("" or ‘‘ or ``);
  • undefined.

Logical Operators

标签:empty   can   sea   val   ISE   operator   script   null   define   

原文地址:https://www.cnblogs.com/rosendolu/p/10206347.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!