Activity Forums Salesforce® Discussions which logical operator works in salesforce lightning component?

  • Prachi

    Member
    November 12, 2019 at 3:02 am

    Hi,

    1. &&
    -> isEnabled && hasPermission
    Returns true if both operands are individually true.If you have more than two arguments, you can chain multiple && operations.

    This syntax is awkward in markup so we recommend the alternative of using the and() function when you have two arguments. For example, and(isEnabled, hasPermission). The and() function only works with two arguments.
    2.||
    ->hasPermission || isRequired
    Returns true if either operand is individually true.If you have more than two arguments, you can chain multiple || operations.

    You can alternatively use the or() function when you have only two arguments. The or() function only works with two arguments.
    3.!
    ->!isRequired
    Unary operator. Returns true if the operand is false. This operator should not be confused with the ! delimiter used to start an expression in {!. You can combine the expression delimiter with this negation operator to return the logical negation of a value, for example, {!!true} returns false.

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos