0
0
Javascriptprogramming~10 mins

Assignment operators in Javascript - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add 5 to the variable num using an assignment operator.

Javascript
let num = 10;
num [1] 5;
Drag options to blanks, or click blank then click option'
A/=
B*=
C+=
D-=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+=' will subtract instead of add.
Using '*' or '/' will multiply or divide instead of adding.
2fill in blank
medium

Complete the code to multiply count by 3 using an assignment operator.

Javascript
let count = 4;
count [1] 3;
Drag options to blanks, or click blank then click option'
A+=
B*=
C-=
D/=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+=' will add instead of multiply.
Using '-=' or '/=' will subtract or divide instead of multiply.
3fill in blank
hard

Fix the error in the code to subtract 2 from score using an assignment operator.

Javascript
let score = 15;
score [1] 2;
Drag options to blanks, or click blank then click option'
A-=
B*=
C+=
D/=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+=' will add instead of subtract.
Using '*=' or '/=' will multiply or divide instead of subtract.
4fill in blank
hard

Fill both blanks to divide total by 4 and assign the result back to total.

Javascript
let total = 20;
total [1] [2];
Drag options to blanks, or click blank then click option'
A/=
B+=
C4
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+=' instead of '/=' will add instead of divide.
Using 2 instead of 4 will divide by the wrong number.
5fill in blank
hard

Fill all three blanks to increase value by 10, then multiply by 2, and finally subtract 5 using assignment operators.

Javascript
let value = 5;
value [1] 10;
value [2] 2;
value [3] 5;
Drag options to blanks, or click blank then click option'
A+=
B*=
C-=
D/=
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of operators.
Using '/=' instead of '*=' or '-='.