JS

JavaScript Code Output Challenge - Function greetw...

8.

What will be the output of the following code?

function greetWithDelay(name, delayInMilliseconds) {
  setTimeout(function() {
    console.log(`Hello ${name}!`);
  }, delayInMilliseconds);
}

greetWithDelay("John", 2000);
greetWithDelay("Alice", 1000);

Hello Alice! only

Hello John! only

Hello Alice! followed by Hello John!

Hello John! followed by Hello Alice!