Finding Out Class Names of JavaScript Objects
JavaScript lacks a built-in function for getting the exact class names of object instances. The typeof operator just returns “object” for instances of both Object and Array, as well as user-defined classes. The constructor property of a JavaScript object (except for intrinsic objects such as window and document) points to the object’s constructor, which has the same name as the class of the object. The name of the constructor can be obtained by parsing out the function name part from the string representation of the contructor.
Tags : how-to javascript programming
You will be redirected to Finding Out Class Names of JavaScript Objects, in 20 seconds.
