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

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

متابعة

Which built-in method reverses the order of the elements of an array?

user-image
تم إضافة السؤال من قبل salma samreen , Quality Assurance Engineer , Private Limited
تاريخ النشر: 2016/02/16
Kariem Soudy
من قبل Kariem Soudy , Web Solutions Consultant , Tatweer Educational Transportation Services Company

reverse()use it like this$(selector).get().reverse()

Muhammad Muhammad Wakeel
من قبل Muhammad Muhammad Wakeel , Web Developer , Dataocean

With Commons.Lang  you could simply use 

 

ArrayUtils.reverse(int[] array)

Most of the time, it's quicker and more bug-safe to stick with easily available libraries already unit-tested and user-tested when they take care of your problem.           

Sajith Kumar Cheruvachery Veettil
من قبل Sajith Kumar Cheruvachery Veettil , Software Engineer , Ace Crane systems

var jqArray= ['1', '2', '3'];

var x=jqArray.reverse(); 

 

Result=['3','2','1']

مستخدم محذوف‎
من قبل مستخدم محذوف‎

var firstArray = [1,2,3];

var result = firstArray.reverse();

result = [3,2,1]

Mohd Tariq Khan Tariq
من قبل Mohd Tariq Khan Tariq , Web Developer , Prolines.sa

var arr= ["Banana", "Orange", "Apple", "Mango"];arr.reverse();

Mohamed Siddiqkhan Mohamed Jalaludeen
من قبل Mohamed Siddiqkhan Mohamed Jalaludeen , PHP Developer , AWOk

var myArray = ['apple', 'orange', 'grape'];myArray.reverse();

Mobeen Khalid
من قبل Mobeen Khalid , VP of Engineering , Lorryz

reverse() is a built on function to reverse the order of array.

Diyaiddin Bader
من قبل Diyaiddin Bader , System Analyst / Programmer , EBTTIKAR TECHNOLOGY CO. LTD.

reverse()

 

Syntax

arr.reverse()

Parameters : none

Description :

The reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array.

Examples

 

var myArray = ['one', 'two', 'three'];

myArray.reverse(); 

console.log(myArray) // ['three', 'two', 'one']

hoda elboray
من قبل hoda elboray , builder , GIT

reverse () Reverse the order of the elements in an array

Sukhdev Kushwaha
من قبل Sukhdev Kushwaha , Sr. Programmer , Ugam Solutions Pvt. Ltd, Goregaon

reverse() function is used to reverse an array data.

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