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 <www...@pochta.ru> wrote:

> the question is: how to check if a function is empty or have any code
>
> On Feb 1, 5:18 pm, Richard Quadling <rquadl...@googlemail.com> wrote:
> > On 1 February 2010 13:02, buda <www...@pochta.ru> 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
> prototype-scriptacul...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com>
> .
> > > 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
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com>
> .
> 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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to