I'm trying to find in the docs / understand this behavior for the following code :
I saw this piece of code here:
function f(){ return f; }
new f() instanceof f; //false
This is because ( from what i've read) :
When the
constructorreturns an object, thenewoperator will yield the returned object
So since f is a function - the new operator will yield the returned object which is f in this case
So : new f() === f
Hence : f instanceof f//false.
Question :
I 'm searching for this behaviour description in the docs , but couldn't find it.
I only found partial answer in mdn :

However - looking at the docs (which is what I really after) :
All it say is :

It doesn't mention the cases where the constructor return object or not( i'm sure i'm missing it)
Question: Where does in the docs that behavior is explained ?
nb ,
I know that constructor function should not (generally) return anything , this question is for knowledge.
nb2 :
example for this behaviour :
var z = {a: 2};
function g() { return z; }
var x = new g();
x === z; //true
Here, x is actually equal to z, down to the identity!