Exam4Training

Which statement allows a developer to cancel the scheduled timed function?

Refer to the code below:

let timeFunction =() => {

console.log(‘Timer called.”);

};

let timerId = setTimeout (timedFunction, 1000);

Which statement allows a developer to cancel the scheduled timed function?
A . removeTimeout(timedFunction);
B. removeTimeout(timerId);
C. clearTimeout(timerId);
D. clearTimeout(timedFunction);

Answer: C

Exit mobile version