function SomeConstructor(){}; someConstructor.prop = …
JavaScript is case sensitive, this is example won't work.
My guess would be that there is still only one copy of prop for obj1 and obj2.
No. There won't be any copies at all. prop
is a property of the function object, and has nothing to do with obj1
or obj2
. It is not inherited by them.
And that's the difference to using a property on the prototype, which is the object from which obj1
and obj2
do inherit.
a static property that is copied directly to the object
Only if by "object" you mean the constructor function here. In JS, there are no classes, and no "static" properties. Yet, the correspondent of "static class attributes" would be properties on the constructor function.