Skip to main content

and

TS JS Deno

Returns true if both arguments are true, false otherwise.

Use the logical and (&&) operator on the two given values.

typescript
const and = <T extends unknown, R extends unknown>(a: T, b: R) => Boolean(a) && Boolean(b);
typescript
and(true, true); // true
and(true, false); // false
and(false, false); // false