Add JavaScript solution problem 3