Added Javascript solution to problem #2