function Person(name){
this.name = name;
}
p = new Person('John');
log(typeof p.constructor);
var f = {};
log(typeof f.constructor);
var f2 = new Object();
log(typeof f2.constructor);
All three log statements show 'function'.
Is there a case when the constructor of an object will NOT be 'function' ?
A constructor is a function in javascript, by definition. So the type will always be "function".
See: http://www.w3schools.com/jsref/jsref_constructor_math.asp
"The constructor property is a reference to the function that created an object."
The Mozilla documentation is even clearer:
Returns a reference to the Object function that created the instance's prototype. Note that the value of this property is a reference to the function itself, not a string containing the function's name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With