continue statement with example in JavaScript

JavaScript continue statement: Here, we are going to learn about the continue statement in JavaScript with example.
Submitted by IncludeHelp, on March 11, 2019

JavaScript continue statement

continue is a keyword in JavaScript, it is used with the looping statements to continue the loop's iteration.

When a continue statement executes, it breakouts the current loop's iteration and continues to the next loop's iteration.

Syntax:

    continue;

Example of continue statement in JavaScript

<html>
<head><title>JavaScipt Example</title></head>

<body>
<script>
	var loop = 1;
	//continues when value of loop is 7
	for(loop=1; loop<=10; loop++){
		if(loop==7)
			continue;
		document.write(loop + " ");
	}
	document.write("<br>");
	document.write("Outside of the loop<br>");
</script>
</body>
</html>

Output

1 2 3 4 5 6 8 9 10 
Outside of the loop

JavaScript Tutorial »


ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT


Top MCQs

Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.