[thelist] JS: Exiting a Function

.jeff jeff at members.evolt.org
Sun Feb 2 14:17:01 CST 2003


syed,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Syed Zeeshan Haider
>
> How to exit a JS function with out completing it and
> without returning any expression?  I have been looking
> in books but couldn't find.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

function doNothing()
{
  return;
}

this will return 'undefined' which can easily be tested for.

function doNothing2(some_condition)
{
  if(some_condition)
  {
    // your function body
  }
}

this will also return 'undefined' if 'some_condition' is not true.

i guess what i'm getting at is there isn't really a way to make a function
that doesn't return anything at all.

can you explain in greater detail what you're trying to do?

thanks,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list