working recursion exercise frontend