Bird
Raised Fist0
Javascriptprogramming~5 mins

Arithmetic operators in Javascript - Cheat Sheet & Quick Revision

Choose your learning style10 modes available
Recall & Review
beginner
What does the + operator do in JavaScript when used with numbers?
It adds two numbers together to produce their sum.
Click to reveal answer
beginner
What is the result of 10 - 4 in JavaScript?
The result is 6, because the - operator subtracts the second number from the first.
Click to reveal answer
beginner
How does the * operator work in JavaScript?
It multiplies two numbers and returns the product.
Click to reveal answer
beginner
What does the / operator do?
It divides the first number by the second number and returns the quotient.
Click to reveal answer
beginner
What is the purpose of the % operator in JavaScript?
It returns the remainder after dividing the first number by the second number, also called the modulus.
Click to reveal answer
What is the result of 7 + 3 * 2 in JavaScript?
A20
B16
C10
D13
Which operator gives the remainder of a division?
A*
B-
C%
D+
What does 15 / 4 return in JavaScript?
A3
B3.75
C4
D3 remainder 3
What is the value of 5 % 2?
A1
B2
C0
D3
Which operator is used to multiply numbers?
A*
B-
C/
D+
Explain how the order of operations affects arithmetic expressions in JavaScript.
Think about which operations happen first when you see multiple operators.
You got /3 concepts.
    Describe the difference between the division operator / and the modulus operator %.
    One tells you how many times a number fits, the other tells you what's left over.
    You got /3 concepts.

      Practice

      (1/5)
      1. Which arithmetic operator in JavaScript is used to find the remainder of a division?
      easy
      A. %
      B. /
      C. **
      D. *

      Solution

      1. Step 1: Understand the remainder operator

        The operator % returns the remainder after division of two numbers.
      2. Step 2: Compare with other operators

        / is division, ** is power, and * is multiplication, so they don't give remainder.
      3. Final Answer:

        % -> Option A
      4. Quick Check:

        Remainder operator = % [OK]
      Hint: Remainder operator looks like a percent sign % [OK]
      Common Mistakes:
      • Confusing division / with remainder %
      • Using * or ** instead of %
      • Thinking + or - can give remainder
      2. Which of the following is the correct syntax to calculate 5 to the power of 3 in JavaScript?
      easy
      A. 5 ** 3
      B. 5 ^^ 3
      C. 5 ^ 3
      D. pow(5, 3)

      Solution

      1. Step 1: Identify the power operator in JavaScript

        JavaScript uses ** to calculate powers, like 5 ** 3 means 5 to the power 3.
      2. Step 2: Check other options for correctness

        ^ is bitwise XOR, ^^ is invalid syntax, and pow() is not a built-in function in JavaScript.
      3. Final Answer:

        5 ** 3 -> Option A
      4. Quick Check:

        Power operator = ** [OK]
      Hint: Use ** for power, not ^ or pow() [OK]
      Common Mistakes:
      • Using ^ instead of ** for power
      • Trying to use pow() like in other languages
      • Typing invalid operators like ^^
      3. What will be the output of the following code?
      console.log(10 % 4);
      medium
      A. 6
      B. 0
      C. 2
      D. 4

      Solution

      1. Step 1: Calculate 10 divided by 4

        10 divided by 4 is 2 with a remainder of 2.
      2. Step 2: Understand the % operator

        The % operator returns the remainder, so 10 % 4 equals 2.
      3. Final Answer:

        2 -> Option C
      4. Quick Check:

        10 % 4 = 2 [OK]
      Hint: Remainder is what's left after division [OK]
      Common Mistakes:
      • Confusing remainder with quotient
      • Thinking % does division
      • Choosing 0 or 4 as remainder incorrectly
      4. Find the error in this code snippet:
      let result = 5 **;
      console.log(result);
      medium
      A. console.log syntax error
      B. Using wrong operator for power
      C. Variable name 'result' is invalid
      D. Missing right operand for ** operator

      Solution

      1. Step 1: Check the power operator usage

        The power operator ** needs two operands, like 5 ** 2. Here, the right operand is missing.
      2. Step 2: Verify other parts of the code

        The variable name and console.log syntax are correct, so no errors there.
      3. Final Answer:

        Missing right operand for ** operator -> Option D
      4. Quick Check:

        Power operator needs two numbers [OK]
      Hint: Power operator needs number on both sides [OK]
      Common Mistakes:
      • Leaving out the second number after **
      • Thinking variable names cause error here
      • Assuming console.log is wrong
      5. You want to split 100 candies equally among 6 kids and find how many candies remain undistributed. Which expression gives the number of leftover candies?
      hard
      A. 100 / 6
      B. 100 % 6
      C. 100 - 6
      D. 100 ** 6

      Solution

      1. Step 1: Understand the problem

        We want the leftover candies after dividing 100 by 6, which means the remainder.
      2. Step 2: Choose the correct operator

        The remainder operator % gives the leftover amount, so 100 % 6 is correct.
      3. Final Answer:

        100 % 6 -> Option B
      4. Quick Check:

        Leftover = total % number [OK]
      Hint: Use % to find leftovers after division [OK]
      Common Mistakes:
      • Using / which gives quotient, not remainder
      • Subtracting numbers directly instead of remainder
      • Using power operator mistakenly
      Recommended

      Ready to prove it?

      Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

      10 questions~5 mineasy hard