Recursion in Javascript Programs