How to run function on JavaScript? -


i want run function sent parameter on javascript, example create script, want script print "successful test" script print whale function text. thus, how can run function sent parameter function?

test=function (p1) {         return p1;                  } var result=test(function(){     return "successful test"; }); console.log(result); 

you should return return p1();

var test=function (p1) {         return p1();                  } var result=test(function(){     return "successful test"; }); console.log(result); 

jsfiddle demo


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -