new Class() pattern I found myself being mysteriously redirected from
http://www.example.com/[object Object] every time I opened the page.
Turns out instead of saying
I had, forgotten the second
new and written
I can’t explain the redirect, but once I added the missing
new keyword everything was back to normal. This happened in a much more convoluted situation which made the missing keyword harder to spot. I guess it goes to show that you shouldn’t try to be clever, even when “just writing an unit test”.