summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/throw.js
blob: 2576ce1356379f21a1e3b606697aa71f7e94789d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Control can exit a for-of loop via throw.

function f() {
    for (var a of [1, 2, 3]) {
        for (var b of [1, 2, 3]) {
            for (var c of [1, 2, 3]) {
                if (a !== b && b !== c && c !== a)
                    throw [a, b, c];
            }
        }
    }
}

var x = null;
try {
    f();
} catch (exc) {
    x = exc.join("");
}
assertEq(x, "123");