Question: This is a javascript code. please show me how to fix it so that it reverses the array. I do not simply want to use

This is a javascript code.

please show me how to fix it so that it reverses the array. I do not simply want to use the reverse() function. Please show me where I am going wrong and correct my code.

function reverseArrayInPlace(arr){

for(i=arr.length; i>0; i--){

arr.push(i)

arr.pop(i)

}

//document.writeln(arrNew)

document.writeln(" ")

document.writeln(arr)

}

reverseArrayInPlace(arr)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!