Valid JS-Dev-101 Dumps shared by EduDump.com for Helping Passing JS-Dev-101 Exam! EduDump.com now offer the newest JS-Dev-101 exam dumps, the EduDump.com JS-Dev-101 exam questions have been updated and answers have been corrected get the newest EduDump.com JS-Dev-101 dumps with Test Engine here:
Refer to the code below: 01 let timedFunction = () => { 02 console.log('Timer called.'); 03 }; 04 05 let timerId = setInterval(timedFunction, 1000); Which statement allows a developer to cancel the scheduled timed function?
Correct Answer: A
The code: let timerId = setInterval(timedFunction, 1000); setInterval schedules timedFunction to run every 1000 ms. It returns an interval ID (here stored in timerId), which is used to cancel the interval later. To cancel: Use clearInterval(timerId); This is the standard browser (and Node.js) API: let id = setInterval(fn, delay); clearInterval(id); stops future executions of that interval. Check other options: B . removeInterval(timerId); There is no removeInterval function in the standard JavaScript timer API. C . removeInterval(timedFunction); Again, no such function; and timers are cancelled by ID, not by the callback function reference. D . clearInterval(timedFunction); clearInterval expects the ID returned by setInterval, not the callback function. Passing the function does not cancel the timer. Therefore, the correct statement is: Answe r: A Study Guide / Concept Reference (no links): Timer APIs: setInterval and clearInterval Relationship between timer ID and cancellation Difference between interval ID and callback function Basic async timing patterns in JavaScript