Alternatively you can do it without creating a closure.
function myFunction(str1, str2) {
alert(str1); //hello
alert(str2); //world
}
window.setTimeout(myFunction, 10, 'hello', 'world');
But note it doesn’t work on IE < 10
according to MDN.
More Related Contents:
- How can I pass a parameter to a setTimeout() callback?
- Why is bracket notation not working here? [duplicate]
- setTimeout in a for loop with array as an argument misbehaving
- Why is the method executed immediately when I use setTimeout?
- Calling functions with setTimeout()
- Chrome: timeouts/interval suspended in background tabs?
- Pass a JavaScript function as parameter
- Adding a parameter to the URL with JavaScript
- What is minimum millisecond value of setTimeout?
- Pass parameter to p:remoteCommand from JavaScript
- Is this an example of variable shadowing in JavaScript?
- Is there ever a good reason to pass a string to setTimeout?
- setTimeout ignores timeout? (Fires immediately) [duplicate]
- setTimeout / clearTimeout problems
- setInterval in a React app
- setInterval/setTimeout return value
- How do I clear this setInterval inside a function?
- Is there a faster way to yield to Javascript event loop than setTimeout(0)?
- How many concurrent setTimeouts before performance issues?
- How to tell .hover() to wait?
- using setTimeout synchronously in JavaScript
- Get return value from setTimeout [duplicate]
- recursive function vs setInterval vs setTimeout javascript
- Why does jQuery.ajax() add a parameter to the url?
- JQuery, setTimeout not working
- Are equal timeouts executed in order in Javascript?
- setTimeout Internet Explorer
- setTimeout() method inside a while loop [duplicate]
- How to pass a parameter to a javascript through a url and display it on a page?
- Passing a function with arguments as an argument?