Working with Timers

In the given code snippet, you have to replace XXXXX with a certain method to get the desired output.

function timerExample() {

console.log(‘Time!’);

}

XXXXX(tierExample, 1000);

What is the correct combination of the method and desired output by substituting that method in place of XXXXX?

Options

1.XXXXX – setTimeout()

Result – timerExample() will execute after any I/O operations(if used) in the current event loop

2.XXXXX – setinterval()

Result – timerExample() will execute about every 1 second until it is stopped

3.XXXXX – setTimeout()

Result – timerExample() will execute as close to 1000 millisecond

4.XXXXX – process.nextTick()

Result – timerExample() will execute as close to 1000 millisecond

Related Posts

Close Bitnami banner
Bitnami