العكسىية أسلوب

إرجاع Arrayكائن مع عناصر عكس.

function reverse() : Array

ملاحظات

The عكسى أسلوب reverses the عناصر of an Array كائن في place. It does not إنشاء a جديد Array كائن during execution.

If the صفيفة ليس contiguous, the عكسى أسلوب creates عناصر في the صفيفة that fill the gaps في the صفيفة. Each of these تاريخ الإنشاء عناصر has the القيمة غير معرّف.

مثال

The following مثال illustrates the استخدم of the عكسى أسلوب.

function ReverseDemo(){
   var a, l;                  //Declare variables.
   a = new Array(0,1,2,3,4);  //Create an array and populate it.
   l = a.reverse();           //Reverse the contents of the array.
   return(l);                 //Return the resulting array.
}

المتطلبات

Version 2

يتم تطبيق إلى:

كائن صفيفة

راجع أيضًا:

موارد أخرى

الأساليب