http://ejohn.org/blog/building-a-javascript-library/
In the above link, John Resig suggests calling and returning new foo in the constructor if the caller initially forgot.
which has some meaning for me, but then I get a severe error, because my constructor does not "always" return a value. Having got a little idea of ββconstructors in javascript, I stopped returning this because new automatically does this.
My question is should I ...
- Do not use the described protective equipment?
- return this to the end of my constructor?
- A secret option that I don't know about?
javascript constructor return-value
griotspeak
source share