Skip to content

Array.concat breaks when extending the Array to custom class using ES6 classes #19314

@AyushG3112

Description

@AyushG3112
  • Version: 8.9.3
  • Platform: Ubuntu 16.04 64-bit
class MyArray extends Array {};

let myArray = new MyArray(6);
myArray = myArray.concat(new MyArray(5));

let array = new Array(6);
array = array.concat(new Array(5));

console.log('myArray length: ', myArray.length);
console.log('array length: ', array.length);

Actual output:

myArray length:  0
array length:  11

Expected output:

myArray length:  11
array length:  11

FEW NOTES:

  • Actual and expected output match when run with node v10.0.0-pre
  • Actual and expected output match when run in the chrome V8 console

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions