You are viewing a single comment's thread. Return to all comments →
**JavaScript------* Stack----
function reverseArray(a) { // Write your code here const stack = [] for (let i=0; i<a.length; i++){ stack.push(a[i]) // console.log(stack) } let rev = [] for(let i=0; i< a.length; i++){ rev.push(stack.pop()) // stack.pop() // rev.push(stack.pop()) console.log(rev) } // console.log(stack) return rev }
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays - DS
You are viewing a single comment's thread. Return to all comments →
**JavaScript------* Stack----