How portable are JavaScript break labels?

A less well-known feature of JavaScript is that you can use labels to break and continue out of nested loop and switch statements:

i_loop: for (i = 0; i < 10; i++) {
    j_loop: for (j = 0; j < 10; j++) {
        if (i == 3 && i < j)
            break i_loop;
    }
}

This feature is the answer to:

My question is, how portable is it? The MSDN documentation has a long list of supported IE versions. The Mozilla documentation says it was implemented in JavaScript 1.2 (released in 1997), and that it is in ECMA-262, 3rd Edition (1999). Going by this, labels should be extremely portable, but can I count on it?

Answers


According to MDN, a labelled break is supported since the "ECMA-262, Edition 3" standard (published in December 1999, so I believe there should not be a single browser out there that does not support it :))


Need Your Help

rails mongoid clear criteria

ruby-on-rails ruby ruby-on-rails-3 mongoid

Mongoid::Paranoia adds a default scope to the model which generates the criteria