This AI is still in early stages of development.
classOf()
Returns the name of the class (constructor) used to create an object...
The following examples compare typeOf() and classOf()...
typeOf(stuff)
typeOf({a: 4}); //"object" typeOf([1, 2, 3]); //"array" typeOf(function(){}); // "function" (function() { return typeOf(arguments); //"arguments" })(); typeOf(new TypeError); //"error" typeOf(new Date); //"date" typeOf(/a-z/); //"regexp" typeOf(Math); //"math" typeOf(JSON); //"json" typeOf(NaN)' //"nan" typeOf(4); //"number" typeOf(new Number(4)); //"number" typeOf("abc"); //"string" typeOf(new String("abc")); //"string" typeOf(true); //"boolean" typeOf(new Boolean(true)); //"boolean" typeOf(global); //"global" typeOf(null); //"null" typeOf(undefined); //"undefined"
classOf(stuff)
classOf({a: 4}); //"Object" classOf([1, 2, 3]); //"Array" classOf(function(){}); // "Function" (function() { return typeOf(arguments); //"Object" })(); classOf(new TypeError); //"TypeError" classOf(new Date); //"Date" classOf(/a-z/); //"RegExp" classOf(Math); //"Object" classOf(JSON); //"Object" classOf(NaN)' //"Number" classOf(4); //"Number" classOf(new Number(4)); //"Number" classOf("abc"); //"String" classOf(new String("abc")); //"String" classOf(true); //"Boolean" classOf(new Boolean(true)); //"Boolean" classOf(global); //"Object" classOf(null); //"Null" classOf(undefined); //"Undefined"