Exam4Training

What is the correct syntax to schedule this function?

A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the function to run once after five seconds.

What is the correct syntax to schedule this function?
A . setTimeout (formatName(), 5000, "John", "BDoe");
B . setTimeout (formatName(‘John’, ‘’Doe’), 5000);
C . setTimout(() => { formatName("John’, ‘Doe’) }, 5000);
D . setTimeout (‘formatName’, 5000, ‘John", "Doe’);

Answer: D

Exit mobile version