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
Get step-by-step solutions from verified subject matter experts
