Question: This is a javascript question could you please help me fix my code. I would like my code to take the arr array and then
This is a javascript question
could you please help me fix my code. I would like my code to take the arr array and then reverse the elements in the array creating a new array called arrNew. I do not want to use the built in reverse() function. Please show me where my code is wrong.
var arr = [1,2,3,4,5,6,7,8,9];
var arrNew = [];
function reverseArray(arr){
for(i=arr.length-1; i>=0; i--){
arrNew = arrNew + arrNew.push(i)
}
document.writeln(arrNew)
}
reverseArray(arr)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
