YouTip LogoYouTip

Misc Type

# jQuery.type() Method [![Image 3: jQuery Misc Methods](#)jQuery Misc Methods](#) ## Example Is the parameter a regular expression? Is this a regular expression? $(function(){ $("b").append("" + jQuery.type( /test/ )); }) [Try it Β»](#) * * * ## Definition and Usage The $.type() function is used to determine the type of a JavaScript built-in object and returns the type name in lowercase. If the object is undefined or null, it returns the corresponding "undefined" or "null". ```javascript $.type( undefined ) === "undefined" $.type() === "undefined" $.type( window.notDefined ) === "undefined" $.type( null ) === "null" If the object has an internal property [] that matches the [] of a browser's built-in object, we return the corresponding [] name. ```javascript $.type( true ) === "boolean" $.type( 3 ) === "number" $.type( "test" ) === "string" $.type( function(){} ) === "function" $.type( [] ) === "array" $.type( new Date() ) === "date" $.type( new Error() ) === "error" // Added support in jQuery 1.9 $.type( /test/ ) === "regexp" ## Syntax _$_.type( obj ) | Parameter | Description | | :--- | :--- | | _obj_ | Any type. The object of any type for which the type needs to be determined. | * * jQuery Misc Methods](#)
← Prop CssnumberMisc Parsejson β†’