Debian Codegraph @

js/src/tests/test262/language/rest-parameters/rest-parameters-apply.js

raw
1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 14.1
5 description: >
6 Rest parameter and Function.prototype.apply
7 ---*/
8 function af(...a) {
9 return a.length;
10 }
11
12 assert.sameValue(af.apply(null, []), 0, "`af.apply(null, [])` returns `0`");
13 assert.sameValue(af.apply(null, [1]), 1, "`af.apply(null, [1])` returns `1`");
14 assert.sameValue(af.apply(null, [1, 2]), 2, "`af.apply(null, [1, 2])` returns `2`");
15 assert.sameValue(af.apply(null, [1, ,2]), 3, "`af.apply(null, [1, ,2])` returns `3`");
16
17 reportCompare(0, 0);