Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is the usage of unshift() method in javascript ?

user-image
Question ajoutée par doaa elsayed , معلم حاسب ألى , مدرسة الأنفوشى الرسمية (لغات)
Date de publication: 2017/04/20
medhatmahmoud mahmoud
par medhatmahmoud mahmoud , Web Designer , Connect Computer Service Co

Adds new elements to the beginning of an array, and returns the new length

vishnuvarthan v
par vishnuvarthan v , Associate programmer , logimax

Add new items to the beginning of an array

example

{

var fruits = ["Banana""Orange""Apple""Mango"];fruits.unshift("Lemon","Pineapple");

}

 

 

 

The unshift() method adds new items to the beginning of an array, and returns the new length.

This method changes the length of an array.

To add new items at the end of an array, use the push() method.

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?