Easter egg (and rant) of the day

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexis Nikichine

    #1

    Easter egg (and rant) of the day

    Hello,

    function isOk()
    {
    return
    ( this.status != cBad )
    && ( this.status != cIll )
    && ( this.status != cDead );
    }

    What does this function returns, and why ? Been hardly bitten today...


    Alexis, the column-saver

    --
    Some domain is free.
  • Martin Honnen

    #2
    Re: Easter egg (and rant) of the day



    Alexis Nikichine wrote:

    [color=blue]
    > function isOk()
    > {
    > return
    > ( this.status != cBad )
    > && ( this.status != cIll )
    > && ( this.status != cDead );
    > }
    >
    > What does this function returns, and why ?[/color]

    It returns undefined as automatic semicolon insertion inserts a
    semicolon after the return so the code is exected as

    function isOk()
    {
    return;
    ( this.status != cBad )
    && ( this.status != cIll )
    && ( this.status != cDead );
    }

    which yields undefined.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...