Master AI & Build your First Coding Portfolio with SkillReactor | Sign Up Now

Lesson 7 - Basic Array Operations

7.3 Push

JavaScript's push() function adds a new element at the end of the array.

let fruits = ['Apple', 'Banana'];
fruits.push('Mango');
console.log(fruits);

Here, we included a new element Mango at the end of the array fruits. Now, include a new element Orange in the array fruits: