Content is available under these licenses. This method can be used with call() or apply() on objects resembling arrays. } By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy, New Year Offer - JavaScript Training Program (39 Courses, 23 Projects) Learn More, JavaScript Training Program (39 Courses, 23 Projects, 4 Quizzes), 39 Online Courses | 23 Hands-on Projects | 225+ Hours | Verifiable Certificate of Completion | Lifetime Access | 4 Quizzes with Solutions, Angular JS Training Program (9 Courses, 7 Projects), Software Development Course - All in One Bundle. var subjects = ["Physics", "Chemistry", "Biology", "Aeronatics"]; document.getElementById("sample").innerHTML = subjects; We can add single or multiple items at the beginning using unshift() method and similar to the push() method, this also returns us the new length of the array. Do not use this method if the second array (moreVegs in the The push() method adds one or more elements to the end of Let's say we want to find a car that is red. Its syntax is as follows − array.push(element1, ..., elementN); Parameter Details. objects, they are not suitable in applications of this method, as strings are immutable. clone, // ['soccer', 'baseball', 'football', 'swimming'], // Merge the second array into the first one, // Equivalent to vegetables.push('celery', 'beetroot'), // ['parsnip', 'potato', 'celery', 'beetroot'], // obj.length is automatically incremented. ["Payal",["Physics",61], ["Chemistry",55], ["Biology",96], ["Aeronatics",56]],