JSFiddle - React, Tailwind, and code Playground
by kpulkit29
JavaScript
function insert(s, ele) {
if(!s.length) {
s.push(ele);
return;
}
}
function reverse(s) {
if(!s.length) return
let top = s[s.length-1];
s.pop();
reverse(s);
insert(s, top);
}