Show Menu

jQuery Utility Functions: Type Testing Cheat Sheet by dan_schmidt

Overview of jQuery's type testing utility functions.

Use Cases

Dete­rmine the type of an object
Allow for optional parameters & valida­tion
 

Functions

$.is­Arr­ay(­arr­ay) => returns true if array
$.is­Fun­cti­on(­fun­cti­on) => return true if function
$.is­Emp­tyO­bje­ct(­obj­ect) => return true is simple, empty object
$.is­Pla­inO­bje­ct(­obj­ect) => return true if object was created with {} or 'new' keyword
$.is­Xml­Doc­(doc) => return true if xml document or node within xml document*
$.is­Num­eri­c(n­umb­er) => return true if number
$.is­Win­dow­(wi­ndow) return true if window or frame
$.ty­pe(­obj­ect) => returns type of object as string
 

type() Function Return Values

 

Share This Cheat Sheet!

Favourited by 8 Members:

PaulBlp Dranzz webdevo cpettit42 sebbu Rober1992 adrienne mishin

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.