This AI is still in early stages of development.
typeOf()
Returns a more accurate object type name than Javascript's native "typeof" operator...
The following examples show the key differences between Javascript's typeof operator and the typeOf() function...
Javascript's typeof operator
typeof {a: 4}; //"object" typeof [1, 2, 3]; //"object" typeof function(){}; // "function" (function() { return typeof arguments; //"object" })(); typeof new ReferenceError; //"object" typeof new Date; //"object" typeof /a-z/; //"object" typeof Math; //"object" typeof JSON; //"object" typeof NaN; //"number" typeof 4; //"number" typeof new Number(4); //"object" typeof "abc"; //"string" typeof new String("abc"); //"object" typeof true; //"boolean" typeof new Boolean(true); //"object" typeof global //"object" typeof null; //"null" typeof undefined; //"undefined"
typeOf(stuff)
typeOf({a: 4}); //"object" typeOf([1, 2, 3]); //"array" typeOf(function(){}); // "function" (function() { return typeOf(arguments); //"arguments" })(); typeOf(new ReferenceError); //"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"