Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (30 sloc) 1.75 KB
<?xml version="1.0"?>
<entry type="method" name="jQuery.type" return="String">
<argument name="obj" type="PlainObject">
<desc>Object to get the internal JavaScript [[Class]] of.</desc>
<desc>Determine the internal JavaScript [[Class]] of an object.</desc>
<p>A number of techniques are used to determine the exact return value for an object. The [[Class]] is determined as follows:</p>
<li>If the object is undefined or null, then "undefined" or "null" is returned accordingly.
<ul><li>jQuery.type(undefined) === "undefined"</li><li>jQuery.type() === "undefined"</li><li>jQuery.type(window.notDefined) === "undefined"</li><li>jQuery.type(null) === "null"</li></ul>
<li>If the object has an internal [[Class]] equivalent to one of the browser's built-in objects, the associated name is returned. (<a href="">More details about this technique.</a>)
<ul><li>jQuery.type(true) === "boolean"</li><li>jQuery.type(3) === "number"</li><li>jQuery.type("test") === "string"</li><li>jQuery.type(function(){}) === "function"</li><li>jQuery.type([]) === "array"</li><li>jQuery.type(new Date()) === "date"</li><li>jQuery.type(/test/) === "regexp"</li></ul>
<li>Everything else returns "object" as its type.</li>
<desc>Find out if the parameter is a RegExp.</desc>
<code><![CDATA[$("b").append( "" + jQuery.type(/test/) );]]></code>
<html><![CDATA[Is it a RegExp? <b></b>]]></html>
<category slug="utilities"/>
<category slug="version/1.4.3"/>
Jump to Line
Something went wrong with that request. Please try again.