Links



Reverse Array in JavaScript

function reverse(arr){
  let len = arr.length - 1;
  let revArr = [];
  for(var i = len; i >= 0 ; i--){
    revArr.push(arr[i])
  } 
  return revArr;
}
let arr = ['Hemant','Yogesh','Tushar','Rakesh','Rajveer'];
console.log('Original Array : ' + arr);
let revArr = reverse(arr);
console.log('Reverse Array : ' + revArr);


Post a Comment

Post a Comment (0)

Previous Post Next Post