Add JavaScript solution problem 4