Ben Murdoch | 3b9bc31 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 1 | // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | var a = [20, 21, 22, 23]; |
| 6 | a.__proto__ = [10, 11, 12, 13]; |
| 7 | |
| 8 | var values = []; |
| 9 | var indices = []; |
| 10 | function callback(value, index, object) { |
| 11 | object.length = 2; |
| 12 | values.push(value); |
| 13 | indices.push(index); |
| 14 | } |
| 15 | a.forEach(callback); |
| 16 | assertEquals([20, 21, 12, 13], values); |
| 17 | assertEquals([0, 1, 2, 3], indices); |