Question 8
Back to Exercise
Which line runs showAlert after 2 seconds?
- A setTimeout(showAlert, 2000); Correct
- B setTimeout(showAlert(), 2000);
- C setTimeout("showAlert", 2000);
- D setTimeout(2000, showAlert);
Correct Answer: Option A
showAlert() would run immediately and pass its return value. Strings are evaluated as code in browsers (and rejected by Node.js), and the order of arguments is callback, delay.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!