Changing d3.max to build-in method