In modern browsers (ie IE11 and beyond), the “setTimeout” receives a third parameter that is sent as parameter to the internal function at the end of the timer.
Example:
var hello = "Hello World";
setTimeout(alert, 1000, hello);
More details:
- https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers.setTimeout
- http://arguments.callee.info/2008/11/10/passing-arguments-to-settimeout-and-setinterval/