It's generally frowned upon to add functions to built-in prototypes since it pollutes the global namespace.  Also see $.grep which is basically a more powerful version of this function: http://api.jquery.com/jQuery.grep/ .