JavaScript/01-reverse.js
// accepts a string, returns a new string in reverse
accepts a string, returns a new string in reverse
accepts a string returns a new string in reverse
function reverse(str) {
  let result = "";
  function helper(helperStr) {
    let str_length = helperStr.length;
    if (helperStr.length === 0) return; 
    result += helperStr.slice(-1); 
    helper(helperStr.slice(0, str_length - 1)); 
  }
  helper(str); 
  return result;
}
function reverse ( str ) { let result = "" ; function helper ( helperStr ) { let str_length = helperStr . length ; if ( helperStr . length === 0 ) return ; result += helperStr . slice ( - 1 ) ; helper ( helperStr . slice ( 0 , str_length - 1 ) ) ; } helper ( str ) ; return result ; }
accepts a string, returns a new string in reverse
accepts a string returns a new string in reverse
// base case // store last char // recur // calls helper function