I think you may be incorrect regarding its version compatibility. See the author's github repository here:
https://github.com/janert/d3-for-the-impatient
> All examples have been verified to work with this version of the D3 library (D3 Version 5.9.2, downloaded 15. Apr 2019)
So, not quite V6, but a lot more up-to-date than v4.
'D3 for the impatient' is indeed an excellent book and was my entry point into using D3 aswell.