Answers for ".reverse js"

2

reverse array javascript

// reverse array with recursion function
function reverseArray (arr){
if (arr.length === 0){
return []
}
  return [arr.pop()].concat(reverseArray(arr))
}
console.log(reverseArray([1, 2, 3, 4, 5]))
Posted by: Guest on July-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language