faqts : Computers : Programming : Languages : JavaScript : Language Core : Functions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

58 of 121 people (48%) answered Yes
Recently 1 of 10 people (10%) answered Yes

Entry

JavaScript: How do I stop a JavaScript function once it has started?

Oct 12th, 2001 02:16
Jean-Bernard Valentaten, Knud van Eeden, Garth Donovan,


------------------------------------------------------------------------
--- Knud van Eeden - 12 October 2001 - 08:40 am ------------------------

The keyword return() can be used to stop.

- If your JavaScript function returns a result, e.g. an integer i,
then you write at the position where you want to stop in that function:

 return( i );


- If your JavaScript function does not return a result, you write at
the position where you want to stop in that function:

 return;

------------------------------------------------------------------------

------------------------------------------------------------------------
--- Jean-Bernard Valentaten --------------------------------------------

... or you could use the break statement
------------------------------------------------------------------------