Avatar ·

How to extend an existing array with another array in JavaScript without creating a new one?

Hello everyone! I just started learning JavaScript and encountered this problem. I have two arrays: ```javascript let fruits = ['apple', 'banana', 'orange']; let moreFruits = ['grape', 'kiwi', 'mango']; ``` I need to add elements from the `moreFruits` array to the end of the `fruits` array, so that I end up with one array `['apple', 'banana', 'orange', 'grape', 'kiwi', 'mango']`. I know that I can do it like this: ```javascript let combined = fruits.concat(moreFruits); // ['apple', 'banana', 'orange', 'grape', 'kiwi', 'mango'] ``` But the problem is that `concat()` creates a **new** array, and I need to modify the **existing** `fruits` array without creating a new one. Why is this important? Because in my code, several variables and functions reference the `fruits` array, and e