0
0
Javascriptprogramming~20 mins

Assignment operators in Javascript - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Assignment Operator Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this code using += operator?
Consider the following JavaScript code snippet. What will be printed to the console?
Javascript
let x = 5;
x += 3;
console.log(x);
A5
B8
C3
D53
Attempts:
2 left
💡 Hint
Remember that += adds the right value to the left variable.
Predict Output
intermediate
2:00remaining
What is the output after using *= operator?
Look at this code. What will be the value of y after execution?
Javascript
let y = 4;
y *= 2;
console.log(y);
A6
B42
C8
D2
Attempts:
2 left
💡 Hint
The *= operator multiplies the variable by the right value.
Predict Output
advanced
2:00remaining
What is the output of this code using combined operators?
What will be printed to the console after running this code?
Javascript
let a = 10;
a -= 3;
a /= 7;
console.log(a.toFixed(2));
A11
B2
C0
D1.00
Attempts:
2 left
💡 Hint
Apply each operator step by step and then format the number.
Predict Output
advanced
2:00remaining
What is the output of this code using %= operator?
What will be the value of b after this code runs?
Javascript
let b = 15;
b %= 4;
console.log(b);
A3
B4
C15
D11
Attempts:
2 left
💡 Hint
The %= operator gives the remainder of division.
Predict Output
expert
3:00remaining
What is the output of this tricky assignment code?
What will be printed to the console after running this code?
Javascript
let c = 2;
let d = 3;
c *= d += 4;
console.log(c);
A14
B10
C8
D6
Attempts:
2 left
💡 Hint
Remember that d += 4 happens first, then c *= d.