Skip to main content
File

title: and tags: math,logic,beginner

TS JS JS

Returns true if both arguments are true, false otherwise.

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

const and = <T = any = boolean>(a: T, b: T) => Boolean(a) && Boolean(b);
and(true, true); // true
and(true, false); // false
and(false, false); // false