Operators

Bitwise or assignment (|=)

Try the free JavaScript compiler

Sets each bit present in either operand and writes the result. This is a bit-mask operation, not short-circuit logical OR.

Formal Syntax & Structure

javascript syntaxjavascript
target |= value

Parameters & Attributes

NameTypeDescription
targetassignment targetWritable binding or property; evaluated once.
valueexpressionRight operand used by the underlying operation.

Return Value

operation result

The value written to the target.

Working Example

Example Snippetjavascript
let n = 4;console.log(n |= 1);
JavaScript Reference