Multiple choice technology architecture

Purpose of the Assignment Operator “^=” in JavaScript?

  1. Assigns the value of the Second Operand to the first Operand.

  2. Subtracts 2 operands and assigns the result to the first operand.

  3. Performs a bitwise exclusive OR operation on 2 operands and assigns the result to the first operand.

  4. Performs a bitwise OR operation on 2 operands and assigns the result to the first operand.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The '^=' operator in JavaScript is a compound assignment operator that performs a bitwise XOR (exclusive OR) operation between two operands, then assigns the result to the left operand. For example, a ^= b is equivalent to a = a ^ b. It does not perform simple assignment, subtraction, or bitwise OR.