Going to talk about something simple that took me a while to figure out I was doing it wrong. Don’t know when I realized it was a big mistake, I just know that it is something I’ve been trying to avoid for a while.
To begin, I’m not the first one to get into this conclusion. Many people before thought about the same thing, it is even one of the JSLint rules (“Do not use ‘new’ for side effects”). The thing is, I don’t think most people know the reason why this should be avoided; so let me explain why.
Constructors are not verbs
I believe that methods should be named as verbs, to make it clear that they perform actions.
new XMLHttpRequestdoesn’t fire the request,
new HTMLDivElement()shouldn’t append it to the document, … – Elliott Sprehn