Can I use the "constructor" property to detect types in JavaScript? Or is there something I should know about it.
For example: var a = {}; a.constructor.name; // outputs "Object"
or var b = 1; b.constructor.name; // outputs "Number"
or var d = new Date(); d.constructor.name; // outputs "Date" not Object
or var f = new Function(); f.constructor.name; // outputs "Function" not Object
only if use it on arguments arguments.constructor.name; //outputs Object like first example
I see quite often developers using: Object.prototype.toString.call([])
or
Object.prototype.toString.call({})