Javascript [Electronic resources] : The Definitive Guide (4th Edition) نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Javascript [Electronic resources] : The Definitive Guide (4th Edition) - نسخه متنی

David Flanagan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


6.10 Labels



The
case and default:
labels used in conjunction with the switch
statement are a special case of a more general label statement. In
JavaScript 1.2, any statement may be labeled by preceding it with an
identifier name and a colon:

identifier: statement

The identifier can be any legal JavaScript
identifier that is not a reserved word. Label names are distinct from
variable and function names, so you do not need to worry about name
collisions if you give a label the same name as a variable or
function. Here is an example of a labeled while
statement:

parser:
while(token != null) {
// Code omitted here
}

By labeling a statement, you give it

a name that
you can use to refer to it elsewhere in your program. You can label
any statement, although the only statements that are commonly labeled
are loops: while, do/while,
for, and for/in. By giving a
loop a name, you can use break and
continue to exit the loop or to exit a single
iteration of the loop.

/ 844