var _mozi=[' mohist ', ' Mozi ', ' Modi ', ' and love non-offensive ', ' still with Shangxian '];
$.each (_mozi,function (key,val) {//First key after value loop
Console.log (Key+val);
})
var Mozig = $.grep (_mozi,function (Val,key) {//filter array first value, post key
Return key<=1;
})
Console.log ("-----------------");
Console.log (Mozig);
var _maparra=$.map (_mozi,function (val) {//convert array by given condition [general]
return return val+ ' [New plus] '; After each element add \ ' [New plus]\ ' character to the array as
Return val== ' Mozi '? ' [only for Meziga] ' +val:val; Only after adding characters to the element Mozi
return [Val, (val+ ' [Extended] ')];//for each element in the original array, extending an added character \ ' [New plus]\ ' element
});
Console.log ("-----------------");
Console.log (_maparra);
var _exist=$.inarray (' Still with Shangxian ', _mozi);//Determine if the value exists in the array
Console.log (_exist);
$.merge (First,second) merging of two arrays [general]
var _mozi2 = ["Chinese", "Wei People", "AFFF", "fffff", "Wei People"];
var _merge = $.merge (_MOZI,_MOZI2);
Console.log ("++++++++++++++");
Console.log (_merge);
$.unique (array) filters repeating elements in an array
Console.log ("000000000000000000");
Console.log (_MOZI2);
Console.log ($.unique (_MOZI2));
Join is to convert an array to a string by joining the parameters of the join.
var pstring = _mozi2.join ("+");
Console.log (_mozi2.join (""));
var obj2 = pstring.split ("+");
Console.log (OBJ2);
JS for Data common operations