🚧logical operator
🚧 under construction -> example
JS ⟩ statement ⟩ expression ⟩ operator ⟩ logical ⟩
a && b:returnsaifais falsy, otherwise returnsb.a || b:returnsaifais truthy, otherwise returnsb.a ?? b:returnsaifais non-nullish, otherwise returnsb.!a:returnsfalseifais truthy, otherwise returnstrue.
&&and||can do short-circuiting.unlike
&&and||,!always returns true or false.
replit:
// Some codeLast updated
Was this helpful?