Q
What will be the value of x after let x = 5; x -= 2;?

Answer & Solution

Answer: Option C
Solution:
The -= operator subtracts 2 from 5, resulting in 3.
Related Questions on Average

Which assignment operator is used to perform multiplication and assignment in one step?

A). =*

B). *=

C). **=

D). //=

How do you write an assignment statement to increment a by 3 in JavaScript?

A). a += 3;

B). a = 3;

C). a == 3;

D). a + 3;

What is the result of `let x = 10; x

A).

B). = 5;`?

C). 10

D). 5

What will be the value of a after let a = 5; a /= 2;?

A). 2

B). 5

C). 10

D). 0

What does let e = 6; e <<= 1; evaluate to?

A). 3

B). 12

C). 6

D). 7

What does the ??= operator do?

A). Logical AND assignment

B). Logical OR assignment

C). Nullish coalescing assignment

D). Bitwise AND assignment

What does the += operator do?

A). Adds and assigns

B). Subtracts and assigns

C). Multiplies and assigns

D). Divides and assigns

How does the &= operator work in JavaScript?

A). Performs a logical AND

B). Performs a bitwise AND

C). Performs a bitwise OR

D). Performs a logical OR

What will be the value of b after let b = null; b ??= 'default';?

A). null

B). 'default'

C). undefined

D). NaN

What will be the value of d after let d = true; d &&= false;?

A). 1

B). 0

C). NaN

D). undefined