[Vuejs]-JavaScript – Pushing Objects into Array failed

2👍

Array is a function, not an empty array. This line

let filteredOrders = Array;

doesn’t create an empty array. It assigns the function Array to filteredOrders. You probably want

let filteredOrders = [];

1👍

The Assignment here:

let filteredOrders = Array;

is type of just a function and no constructor function is generated.
instead you can try doing this

let filteredOrders = new Array(); 
or 
let filteredOrders = [];

which will give you access to the Array methods

Leave a comment