javascript - Passing a function as argument -


here exemple :

function a(b) {     b(); }  function b() {     alert("d"); }  function c() {     alert("e"); }  a(c);//output e 

with fiddle : http://jsfiddle.net/yqes3/

how can fire real b function a?

if b function isn't global, , don't want use naming conventions, create additional function

function d() {     b(); } 

and call 1 instead. still think should name argument , function else though, it'd create less confusion other person (this include future version of yourself) looking @ code.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -