[thelist] "return" in JS question

Tom Dell'Aringa pixelmech at yahoo.com
Tue Jun 4 13:20:01 CDT 2002


Andy's solution made me want to ask this question which still confuses me for some reason.

I understand that when using return in a function, you can return a value. I can do

return x;

and return x to the caller of the function.

But how does return function otherwise? Andy used:

function checkSize() {
  var fs = document.getElementById("yourFrameset");
  var fsRows = fs.rows.split(",");
  if (fsRows[2] == 0) {
    return;
  }
  if (fsRows[1] > 335) {
    fs.rows = "25,335,*";
  }
}

I assume the return; here exits you out of the script - is this correct? I've never quite
understood the concept - return by itself also assumes "return true"..is this correct? I've looked
it up on the web dozens of times yet still am not straight on it.

Tom

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the thelist mailing list