summaryrefslogtreecommitdiff
path: root/js/src/jit-test/tests/for-of/arguments-1.js
blob: fddb047e1e3557a0bd2c3da4cae2802a83f9e86e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// for-of can iterate arguments objects.

load(libdir + "iteration.js");

// Arguments objects do not have a .@@iterator() method by default.
// Install one on Object.prototype.
Object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];

var s;
function test() {
    for (var v of arguments)
        s += v;
}

s = '';
test();
assertEq(s, '');

s = '';
test('x', 'y');
assertEq(s, 'xy');