Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Using a decrementing For Loop to Reverse an Array

var arr = [1, 2, 3, 4];
var arr1 = [];
for (let i = arr.length - 1; i >= 0; i--) {
    arr1.push(arr[i]);
}
console.log(arr1);
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Using #decrementing #For #Loop #Reverse #Array
ADD COMMENT
Topic
Name
4+9 =