Re: How can I have one function call another function dynamically?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: How can I have one function call another function dynamically?

From: askMe <askMe@askblax.com>
Date: Sun Jul 17 2005 - 14:08:26 CEST

Randell D. wrote:
> Randy Webb wrote:
>
> > Robert wrote:
> >
> >> VK wrote:
> >>
> >>>> Are you saying it is not valid JavaScript?
> >>>
> >>>
> >>>
> >>>
> >>> *Roughly* that.
> >>>
> >>> As such Function will be evaluated on each call, it's performance is
> >>> lower than with standard function(). So it's suggested to use it only
> >>> if you really need to create run-time functions from the scratch.
> >>
> >>
> >>
> >> Yes, that is exactly what he asked for.
> >> name -> function call
> >> It could not have been done using a literal function to my knowledge.
> >>
> >> Anyway,
> >> eval(name+"()")
> >> is a better solution.
> >
> >
> > NO.
> >
> > window[name+'()']
> >
> > is a better solution.
> >
>
> This use of the window object (method?) I like... I'm going to play
> around with it...
>
> And with regards to eval - My experience thus far has been to avoid
> using eval where possible because of its overheads... but excusing the
> performance weight, its simple, and functional...
>

Eval keeps it simple! (K.I.S.S.)

http://www.askblax.com

> Thanks,
> randelld
Received on Tue Oct 18 02:57:11 2005