Jump to content

[SOLVED] treat var as a function


jaymc

Recommended Posts

Dont as why, but I need this to work

 

function beans() {
alert('hello');
}

var do_function = beans
do_function();

 

 

In essance do_function() is really beans();

so I could execute the beans() function using either of the below

 

do_function();

beans();

 

This doesnt work, maybe i am missing something, how can i achieve this?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/109623-solved-treat-var-as-a-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.