20 Beginner JavaScript Questions on Arithmetic, Assignment & Comparison Operators

Last Updated: June 14, 2025

If you’re just starting your journey into JavaScript, one of the first things you’ll need to master is how the language handles basic operations and comparisons. JavaScript uses arithmetic, assignment, and comparison operators to perform calculations, store values, and make decisions in code. These operators form the foundation of most JavaScript programs—from simple calculators to dynamic web applications. In this post, we’ve put together 20 beginner-friendly questions to help you practice and solidify your understanding of these essential concepts. Whether you’re preparing for an interview or brushing up your skills, this is a great place to start!

🔢 Arithmetic Operators (7 Questions)

  1. What is the result of 5 + 3 in JavaScript?
  2. What does the % operator do? Give an example.
  3. Write a JavaScript expression that multiplies 4 and 6.
  4. What is the output of 10 / 2?
  5. What will 2 ** 3 return?
  6. How can you subtract 15 from 30 using JavaScript?
  7. What will be the output of this code?
    let a = 10;
    let b = 3;
    console.log(a % b);
    

📝 Assignment Operators (7 Questions)

  1. What does the = operator do in JavaScript?
  2. Explain the difference between = and == in JavaScript.
  3. What will this code print?
    let x = 5;
    x += 3;
    console.log(x);
    
  4. What does x *= 2 mean?
  5. Rewrite this code using a shorthand assignment operator:
    let a = 10;
    a = a - 4;
    
  6. What is the value of x after this code runs?
    let x = 20;
    x /= 4;
    
  7. What is the output?
    let a = 5;
    a **= 2;
    console.log(a);
    

⚖️ Comparison Operators (6 Questions)

  1. What is the difference between == and ===?
  2. What will this return:
    console.log(5 == '5');
    
  3. What will this return:
    console.log(5 === '5');
    
  4. What does the != operator do?
  5. What is the result of:
    console.log(10 > 5);
    
  6. Which operator would you use to check if two values are not equal in both value and type?