I see the value of this, cause it denote not only the constructor, but what an
object is:
Object.getConstructorOf("")//String
Object.getConstructorOf(0)//Number
Object.getConstructorOf(function(){})//Function
Object.getConstructorOf({})//Object
Object.getConstructorOf([]);//Array
If you try the fist to with Object.getPrototypeOf("");
Object.getPrototypeOf(0);
You'll get an error message, cause primitive value don't have prototype. But
they do have wrapper objects; constructor objects.
This to me is a needed feature of the language.
E-S4L
N-S4L
J-S4L
> On Sep 19, 2014, at 11:08 AM, "L2L 2L" <[email protected]> wrote:
>
> I'll like to also proposal all method dealing with prototype as in
> getPrototypeOf, have a counterpart for constructor.
>
> E-S4L
> N-S4L
> J-S4L
>
>> On Sep 17, 2014, at 11:13 AM, "L2L 2L" <[email protected]> wrote:
>>
>>
>> Object.getConstructorOf = function (obj){
>> return (((obj).constructor).toString().match(/\s\w+/)[0].trim());
>> }
>>
>> Object.getConstructorOf(function(){});//function
>>
>> /*
>> there is no way to test for constructor via function.
>> */
>>
>> E-S4L
>> N-S4L
>> J-S4L
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss