Easter egg (and rant) of the day

A

Alexis Nikichine

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
 
M

Martin Honnen

Alexis Nikichine wrote:

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

What does this function returns, and why ?

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top