Function expr

  • Evaluates a numerical or logical expression.

    Parameters

    • arg: any
    • Rest ...expressions: any[]

    Returns any

    Example

    exp("1 + 2"); // 3
    

    Example

    const new_balance = expr`
    + ${initial_balance}
    + ${sales}
    - ${expenses}
    `;

    Example

    const F = expr`
    * ${gravitational_constant}
    * ${mass_a}
    * ${mass_b}
    / ${Math.pow(distance, 2)}
    `;

    Example

    if (expr`
    && ${is_eligible}
    && (
    || ${is_of_age}
    || ${has_parental_consent}
    )
    `) {}

Generated using TypeDoc