working js soln