0👍
It outputs the entire fruit items because you are pushing the whole array into the basket array, not the actual items. Saying basket
is an array of array, not an array of fruits.
// Instead of this
this.basket.push(this.fruits); // [['Orange', 'Apple']]
// Use array destructuring
this.basket.push(...this.fruits); // ['Orange, 'Apple']
// Or concat
this.basket.concat(this.fruits); // ['Orange, 'Apple']
Source:stackexchange.com