I also had this thought. The worked example uses atan rather than atan2 so I wanted to keep the JavaScript example consistent with that. I can change this if you still feel it is important.