var arr = [1,2,3,4];
arr.reverse();
console.log(arr);
var arrayReverse = ["s", "o", "f", "t", "h", "u", "n", "t"]. reverse ();
["t", "n", "u", "h", "t", "f", "o", "s"]
let mainFunction=(arr)=>{
if(arr.length %2 != 0 ){
return false
}
else{
for (let i=0 ; i < arr.length /2 ; ++i ){
let temp=arr[i];
arr[i]=arr[i + arr.length /2]
arr[i+ arr.length /2]= temp
}
}
return arr
}
console.log(mainFunction([1,2,4,6]))
//output
// [4,6,1,2]