Originally Posted by Labrar
Maybe i am absolutely wrong but
I'm not really sure if
syntax-wise both will work. the only difference between the two is that
is a constructor for certain (so it will work as intended, although extending the JS base object is a no-go), while for
it depends, if it is a constructor--no problem, if it is an object instance (usually not a constructor) the prototype of the object (and not that of its constructor) is modified, i.e. only the prototype of this object. how useful that is depends on the situation.
note: that kind of statement is used when coding object extend functionality (inheritance).