jQuery.type(obj) (alias $.type) returns a lowercase string for the value’s internal JavaScript [[Class]] (added in jQuery 1.4.3). It is clearer than typeof for null, arrays, dates, and regexps.
Pass any value, read the type string, then branch.
Start with a value whose kind you need to know.
Call $.type(value) to get a lowercase string.
Compare with === "array", === "null", and so on.
In new code, prefer native checks instead of $.type.
Piece
Required?
Role
obj
Usual
Value to classify (omit → "undefined")
Return
—
Lowercase type string
Fallback
—
Unknown objects become "object"
Pseudocode
Pseudocode
function type(obj):
if obj is undefined: return "undefined"
if obj is null: return "null"
// use internal [[Class]] for built-ins
return className.toLowerCase() // "array", "date", ...
// Typical flow:
kind = $.type(input)
if kind === "array":
loop items
else if kind === "null":
handle missing value
Reference
Cheat Sheet
Keep these facts handy while classifying values with jQuery.
var when = new Date();
var pattern = /^\d+$/;
console.log($.type(when)); // "date"
console.log($.type(pattern)); // "regexp"
console.log(typeof when); // "object"
Built-ins. Date and RegExp are objects with distinct [[Class]] tags.
$.type. Those tags become "date" and "regexp".
typeof. Both look like plain "object".
Modern. Use value instanceof Date or value instanceof RegExp when that is enough.
Edge Cases & Pitfalls
Check these before relying on type strings in real apps.
deprecated
Removed in jQuery 4.0
Do not start new features on $.type. Prefer native checks so upgrades stay smooth.
no args
$.type() means undefined
Calling with no argument returns "undefined" — same as passing undefined.
wrappers
Boxed primitives still match
new String("test") is "string", new Number(3) is "number" — same labels as primitives.
jquery
jQuery collections are "object"
$.type($("div")) does not say "jquery". Check for a jQuery object another way if you need that.
Compatibility
Browser Support
jQuery.type() existed in jQuery 1.4.3–3.x, was deprecated in 3.3, and removed in 4.0. Prefer native checks in all modern browsers. This page focuses on browser use with jQuery loaded.
✓ Deprecated · jQuery 3.3
jQuery.type()
Available with jQuery 1.4.3–3.x in Chrome, Firefox, Safari, and Edge. Prefer Array.isArray / typeof / toString.call for new code. Not present in jQuery 4.0.
LegacyPrefer natives
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.type()Legacy
Bottom line: Learn $.type() for legacy jQuery code. Write native type checks in new projects and before upgrading to jQuery 4.
Analysis
Performance Notes
Approach
Cost
Best for
typeof x / x === null
Cheapest
Primitives and null checks
Array.isArray(x)
Very cheap
Array detection in new code
$.type(x)
Small helper cost
Legacy jQuery branching only
Type checks are cheap next to DOM work. Prefer the narrowest native test for your case instead of always asking for a full type string.
Remember
Key Takeaways
Role:$.type(value) → lowercase [[Class]] string.
Wins: accurate null, array, date, regexp.
Modern: prefer native checks over $.type.
Status: deprecated in 3.3, removed in 4.0.
One line: know $.type for legacy jQuery branching, but classify values with native checks in every new project.
Frequently Asked Questions
jQuery.type(obj) returns a lowercase string for the value’s internal JavaScript [[Class]] — such as "null", "array", "date", "regexp", "string", or "object". It fixes common typeof surprises.
typeof null is "object" and typeof [] is "object". $.type(null) is "null" and $.type([]) is "array". $.type also returns "date" and "regexp", which typeof cannot name.
Common values include undefined, null, boolean, number, string, function, array, date, regexp, error, symbol, and object. Anything else that is an object usually falls through to "object".
jQuery.isArray(obj) is effectively $.type(obj) === "array". Use isArray for a boolean; use type when you need the full type name for branching.
Not for new code. It was deprecated in jQuery 3.3 and removed in 4.0. Prefer Array.isArray, typeof for primitives, and Object.prototype.toString.call for richer checks.
Calling $.type() with no value returns "undefined" — same as $.type(undefined).