Skip to content

Instantly share code, notes, and snippets.

@pitsanujiw
Created January 11, 2021 11:01
Show Gist options
  • Save pitsanujiw/a792be506ab5e76f7b1dbc0bd74d170d to your computer and use it in GitHub Desktop.
Save pitsanujiw/a792be506ab5e76f7b1dbc0bd74d170d to your computer and use it in GitHub Desktop.
function reverse(nums) {
if (!nums) return;
let newList = [];
for (let i = nums.length -1; i >= 0; i--) {
newList.push(nums[i]);
}
return newList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment