Amazon Interview Question

flatten array using recursion in javascript