Skip to main content

Description

Performs a bitwise AND operation on two integers. Each bit in the result is 1 only if the corresponding bits in both operands are 1.

Syntax

Parameters

Returns

Type: number (integer) The result of the bitwise AND operation.

Examples

Example 1: Basic AND Operation

Output:
(Binary: 1100 AND 1010 = 1000 = 8)

Example 2: Checking Permission Flags

Example 3: Masking Bits

Notes

  • Operates on 32-bit signed integers in JavaScript
  • Both operands are converted to integers if needed
  • Commonly used for flag checking and bit masking

See Also

Frequently Asked Questions

It returns an integer where each bit is 1 only if the corresponding bits in both input operands are 1. For example, flex.bitwise.and(6, 3) returns 2.
Yes. A common pattern is flex.bitwise.and(userPermissions, requiredFlag) = requiredFlag to test whether a specific permission bit is set.