Created
February 15, 2018 19:52
-
-
Save caglarorhan/79e990943f8bd810af777f2a4ebef83b to your computer and use it in GitHub Desktop.
Reverse an array using for loop, pop and push
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var A = [1,2,3,4,5,6,7,8,9]; | |
var B=[]; | |
var ALength = A.length; | |
for(var xcv=1;xcv<=ALength;xcv++) { | |
B.push(A[ALength-xcv]); | |
} | |
console.log(B); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment