This is getting into dirty territory (or at least I'd feel so) but:
>>> var x = function(){};
>>> var y = function(){ alert("foo"); }
>>> x + "";
"function () { }"
>>> y + "";
"function () { alert("foo"); }"
Best,
Alex
On Mon, Feb 1, 2010 at 10:29 AM, buda <[email protected]> wrote:
> the question is: how to check if a function is empty or have any code
>
> On Feb 1, 5:18 pm, Richard Quadling <[email protected]> wrote:
> > On 1 February 2010 13:02, buda <[email protected]> wrote:
> >
> >
> >
> >
> >
> > > var Obj = {};
> > > Obj.meth = Prototype.emptyFunction;
> >
> > > if (Obj.meth !== Prototype.emptyFunction) {
> > > alert('Not equal');
> > > }
> >
> > > why alert show everytime?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Prototype & script.aculo.us" group.
> > > To post to this group, send email to
> [email protected].
> > > To unsubscribe from this group, send email to
> [email protected]<prototype-scriptaculous%[email protected]>
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/prototype-scriptaculous?hl=en.
> >
> > Why?
> >
> > The main advantage of the emptyFunction is that you can always call it
> > without having to do a null/undefined test first.
> >
> > If you want to know if it has been assigned something, then don't
> > assign the emptyFunction, leave it as null and then test if it is
> > null.
> >
> > --
> > -----
> > Richard Quadling
> > "Standing on the shoulders of some very clever giants!"
> > EE :http://www.experts-exchange.com/M_248814.html
> > EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp
> > Zend Certified Engineer :
> http://zend.com/zce.php?c=ZEND002498&r=213474731
> > ZOPA :http://uk.zopa.com/member/RQuadling- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<prototype-scriptaculous%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.