Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q675 How do you get out of a loop once a certain condition is met?

You are here: irt.org | FAQ | JavaScript | Misc | Q675 [ previous next ]

By using break; as in:

<SCRIPT LANGUAGE="JavaScript"><!--
for (var i=0;i<10;i++) {
    if (i == 5)
        break;
    document.write(i);
}
//--></SCRIPT>

©2018 Martin Webb