In this answer, We have share How to write a JavaScript program to pass a JavaScript function as parameter. Here is an example:
1 2 3 4 5 6 7 8 9 10 11 | function addContact(id, refreshCallback) { refreshCallback(); // You can also pass arguments if you need to // refreshCallback(id); } function refreshContactList() { alert('Hello World'); } addContact(1, refreshContactList); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.