Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the jump statements in javascript

Shulou Source: shulou.com Published: 2022-06-02 00:52:16 11月28日 Update

The content of this article mainly focuses on what are the jump sentences in javascript. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!

Two kinds of jump statements in javascript: 1, break statement, used to exit the loop or exit a switch statement, let the program continue to execute the code after the loop, syntax "break;"; 2, continue statement is used to exit this loop and start the next loop, syntax "continue;".

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

There are two main jump statements supported by javaScript:

Break statement

Continue statement

The main difference between the break statement and the continue statement is that break ends the loop completely and continue ends the loop.

1. Break statement:

Break statements are used to exit a loop or a switch statement, allowing the program to continue executing the subsequent code. Break statements are usually used in while,do...while,switch or for statements

Syntax:

Break

Description:

Break statements are usually used in while,do...while.switch or for

For example:

The break statement var n = 50; var sum=0; for (var item0

Tags: Statements loops syntax browsing code content effects articles programs articles behaviors pages support different elements interests at the same time multiple platforms Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Microsoft Xiaomi Linux