I would like to find the type of a Javascipt object (the name of the constructor function) but I keep just getting a generic "Object" back with all methods I have tried. I have searched online and no Javascript method I have found has work for me yet. It always just returns the object constructor type as a generic "Object". Yet there it is, staring right at me when I inspect it in the Chrome console. Any ideas how I might get that information in JS?
PS. I am using Browserify's require to separate my code if that make a difference.
The reason I thought it might be because of how Browserify loads require
code is because this is the output I get from a Browserify loaded constructor function:
And here is what I get from creating a constructor function manually:
Regardless of that and regardless of how I create my constructor function var Prey = function() {}
vs var Prey = function Prey() {}
the Chrome dev tools still seem to know what the name of the constructor function was even when Javascript does not seem to know. Perhaps this is because they can inspect the code in the virtual machine in a way the the Javascript language does not have access to but I am wondering if I am missing something. Does anyone know of another way to determine an instance type in Javascript?