Code Ninjas Interview Question

javascript question and problem solving