MCQs > IT & Programming > Node.js > Which of the following is the correct program code that repeatedly calls a function after every two seconds for continuous eight seconds. and after that clears the interval with the message Which of the following is the correct program code that repeatedly calls a function after every two seconds for continuous eight seconds. and after that clears the interval with the message 'Loop ends' and exits the application?

Node.js MCQs

Which of the following is the correct program code that repeatedly calls a function after every two seconds for continuous eight seconds. and after that clears the interval with the message "Loop ends" and exits the application?

Answer

Correct Answer:

var count = 0;


var obj1 =setlnterval(function(){


count++;


console.log(count, '2 seconds has passed‘);

if(count = 4) [


console.log('Loop ends');


clearlnterval(obj1); ]


},2000); 


Explanation:

Note: This Question is unanswered, help us to find answer for this one

Node.js Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More Node.js MCQ Questions

search

Node.js Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it