Return value of variable.constructor

Return value of variable.constructor
0

#1

let’s say that there is a constructor function here:

function Dog(name){
	this.name = name;
}

let new_variable = new Dog("puppy");

console.log(new_variable.constructor);
console.log(new_variable.constructor===Dog);

the 1st console.log will return you a function , because .constructor will return you a reference of the constructor function, following this logic if .constructor will return you a function, shouldn’t be the second statement becomes:

new_variable.constructor===Dog()??


#2

TLDR:

if the 1st one returns me a function, shouldn’t be the second one be:

new_variable.constructor===Dog()???


#3

Uhm…i think that Dog() would be a reference to a new instance of the function.
Using Dog you compare the reference to the function used to construct, which correspond to the constructor of new_variable ^^

EDIT:
Mh, nope ^^ Dog() would not be a reference to a new instance ( new Dog('..') would be ), It would just return nothing, so you would compare new_variable.constructor with a undefined value i gues^^


#4

I think that this makes sense.