Add JavaScript solution problem 6