$. Method
(1) $.merge (first, second)Merges two arrays or class arrays, adds the second array to the end of the first array
(2) $.grep (Elems, callback, invert) use callback to filter Elems if invert is set to True. Returns an array of elements that retain the callback return value of false. If invert is set to False, callback returns an array of elements that return a value of true.
Test_script
var arr = [ ' A ' , ' B ', ' C ']arr = $.grep (arr,
function (){ //arguments[0] is elem,arguments[1] for Elem in arraythe index in
if (arguments[1] = = 1) {
return
false; }
Else {
return
true; } },
true );alert (arr[0]);//' B '
(3) $.proxy (FN, CONTEXT[,ARGS1][,ARGS2] ...)executes the environment for the FN binding context, returning the object after the agentTest_script
function A () { alert (arguments.length)//3Alert (
This . JQuery); //11 }
var proxy = $.proxy (A, {JQuery: ' One ' }, ' Arg1 ', ' arg2 ');Proxy (' args3 '); $.proxy Source Proxy:
function(FN, context) {
var tmp, args, proxy;
//If parameter context is a string, fix parameter
if (
typeofcontext = = ="string" ) {TMP = fn[context]; //execution Context first parametercontext = fn; The //function is the property value of the first parameter named second parameterfn = tmp; }
//Quick Check to determine if target was callable, in the spec //This throws a TypeError, but we'll just return undefined.
if (!jquery.isfunction (FN)) {
return
undefined ; }
//Simulated bind //2 parameters after the argument as the agent after the objectargs = slice.call (arguments, 2); //Agent post function proxy =
function() {
return fn.apply (Context | |
This, Args.concat (slice.call (arguments))); };
//Set the GUID of unique handler to the same of original handler, so it can be removed //Set the unique identifier of the proxy functionproxy.guid = Fn.guid = Fn.guid | | jquery.guid++;
return proxy; },