Home > Web Front-end > JS Tutorial > body text

javascript break specifies tag to break multi-layer loop example_javascript skills

WBOY
Release: 2016-05-16 17:03:00
Original
1212 people have browsed it

When I was reading the authoritative guide to JavaScript today, I found that there are two types of break syntax (break; and break label;). . . I never looked carefully before, it was just on the first few pages.

But I didn’t understand how to write label, so I checked online and found an example

Copy code Code As follows:

function foo ()
{
dance:
for(var k = 0; k < 4; k ){
for(var m = 0; m < 4; m ){
if(m == 2){
break dance;
}
}
}
}

This way you can break the entire loop nest directly! !

(The breaks in c and java are all like this, so you don’t study seriously...)
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template