blob: 6f08da1f92392e32aa6b27857b3c8d14a3641655 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright (c) 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/*---
esid: sec-array.of
es6id: 22.1.2.3
description: Array.of does not use prototype properties for arguments.
info: |
It defines elements rather than assigning to them.
---*/
Object.defineProperty(Array.prototype, "0", {
set: function(v) {
throw new Test262Error('Should define own properties');
}
});
var arr = Array.of(true);
assert.sameValue(arr[0], true, 'The value of arr[0] is expected to be true');
function Custom() {}
Object.defineProperty(Custom.prototype, "0", {
set: function(v) {
throw new Test262Error('Should define own properties');
}
});
var custom = Array.of.call(Custom, true);
assert.sameValue(custom[0], true, 'The value of custom[0] is expected to be true');
reportCompare(0, 0);
|