🚧logical operator

🚧 under construction -> example

JSstatementexpressionoperator ⟩ logical ⟩

  • a && breturns a if a is falsy, otherwise returns b.

  • a || breturns a if a is truthy, otherwise returns b.

  • a ?? breturns a if a is non-nullish, otherwise returns b.

  • !areturns false if a is truthy, otherwise returns true.

🌟 table of operators

  • && and || can do short-circuiting.

  • unlike && and ||, ! always returns true or false.

convert any value to Boolean.

!!x    // conversion: any -> true/false

Last updated