and
Returns true
if both arguments are true
, false
otherwise.
Use the logical and (&&
) operator on the two given values.
typescript
const and = <T = any = boolean>(a: T, b: T) => Boolean(a) && Boolean(b);
typescript
and(true, true); // true
and(true, false); // false
and(false, false); // false