and()

Performs a bitwise AND operation on one or more integers.

Syntax

and(value1, [value2, ...])

Parameters

Parameter Type Description
value1 Number The first integer value.
value2..N Number Additional integer values to apply AND with. optional

Return Value

Examples

Single value, returns itself

and(5);      // returns 5

Bitwise AND of 5 (0101) and 3 (0011) → 0001

and(5, 3);   // returns 1

Bitwise AND of 7 (0111), 3 (0011), and 1 (0001) → 0001

and(7, 3, 1); // returns 1

See also

bit
not
and
or
xor
nand
nor
xnor
shl
shr