javascript - passing arguments to callback -


how can pass arguments callback function in specific scenario.

i have function gets object callbacks this

function dosomething({ callbacksuccess : myfunction, callbackerror : myotherfunction}) 

how can pass arguments myfunction or myotherfunction?

like, if myotherfunction gets msg parameter this

function myotherfunction(msg) {    alert(msg); } 

thanks in advance

simplest of all:

function dosomething(callback) {     //some code-poetry;     callback(1, 2, 3); //the callback back!!! }  function foo(a, b, c) {//this callback     alert("i got parameters") }  dosomething(foo); //the function call 

best explanation callback function:check this

a simple defination be:the callback function called @ point in future when code or function completes execution.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -