Bird
0
0

Which of the following is the correct syntax to stop a repeating timer started with setInterval?

easy📝 Syntax Q12 of 15
Node.js - Timers and Scheduling
Which of the following is the correct syntax to stop a repeating timer started with setInterval?
AclearInterval(timerId);
BstopInterval(timerId);
CclearTimeout(timerId);
DcancelInterval(timerId);
Step-by-Step Solution
Solution:
  1. Step 1: Identify the function to stop intervals

    clearInterval is the built-in function to stop intervals.
  2. Step 2: Check other options

    clearTimeout stops timeouts, others are invalid functions.
  3. Final Answer:

    clearInterval(timerId); -> Option A
  4. Quick Check:

    clearInterval stops intervals [OK]
Quick Trick: Use clearInterval with the interval ID [OK]
Common Mistakes:
  • Using clearTimeout to stop intervals
  • Using non-existent functions like stopInterval
  • Not passing the timer ID to clearInterval

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes