how can 'view' test1 an Obj2 istance if I haven't link both via prototype chain?
Methods are not bound in JavaScript. When you write one of:
o.method(x);
o['method'](x);
the value of ‘o’ is assigned to ‘this’ inside the method. But! If you detach the function from its object and call it directly:
m= o.method;
m(x);
the reference to ‘o’ is lost, and the method is called as if it were a plain old function, with the global object as ‘this’. Similary, if you move the function to another object and call it there:
o2.method= o.method;
o2.method(x);
then ‘this’ will be ‘o2’, and not ‘o’. This is extremely strange behaviour for a language with first-class functions, and highly counter-intuitive, but that's JavaScript for you.
If you want to be able to use bound methods, you'll need to create your own, generally using a closure. See ECMAScript 3.1's proposed "Function.bind" method or the similar implementation in many frameworks.
So anyway:
this.ob = Obj1;
this.ob(par);
This is taking Obj1 as a function and turning into a method on ‘this’, which is an Obj2 instance. So when Obj1 is called, its own ‘this’ is also an Obj2, and that's the ‘this’ it writes its param to. The same could be written more simply and clearly as:
Obj1.call(this, par);
Are you doing this deliberately? It can be used as a kind of inheritance, to call another class's constructor on your own class, and this method is taught in some JS object-orientation tutorials. However it really isn't a very good way of doing it because you end up with multiple copies of the same property; using prototypes would save you this, and make a property update on a superclass filter through to the subclasses as expected.