ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل doaa elsayed , معلم حاسب ألى , مدرسة الأنفوشى الرسمية (لغات)
تاريخ النشر: 2017/04/20
medhatmahmoud mahmoud
من قبل medhatmahmoud mahmoud , Web Designer , Connect Computer Service Co

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

vishnuvarthan v
من قبل 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.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟