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

How to show in django cms breadcrumbs full path? -

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -