Skip to content

Instantly share code, notes, and snippets.

@soyart
Created September 15, 2021 09:36
Show Gist options
  • Select an option

  • Save soyart/22d6c8a33d978bfb0e4bc894534a39c7 to your computer and use it in GitHub Desktop.

Select an option

Save soyart/22d6c8a33d978bfb0e4bc894534a39c7 to your computer and use it in GitHub Desktop.
const arr = ["abc", "def", "xyz"];
function reverseArray(inArr) {
const result = new Array;
for (let i = inArr.length - 1; i >= 0; i--) {
result.push(inArr[i]);
}
return result;
}
console.log(reverseArray(arr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment