add javascript prob2 solution