标签:
//1. $.trim(); //字符串去空格
//2. $.each //循环
/*var a = [‘a‘,‘b‘,‘c‘];
$.each(a, function(index,value){
console.log(index + ‘ ‘ + value);
});
var o = {‘name‘:‘zh‘,‘age‘:‘21‘,‘love‘:‘ss‘};
$.each(o, function(index,value){
console.log(index + ‘ ‘ + value);
});*/
//3. $.grep //数组筛选
var nums = ‘1,2,3,4,5,jQuery,CSS,5‘.split(‘,‘);
/*nums = $.grep(nums,function(num,index){
return isNaN(num);
});*/
//4. $.map //数组数据变更
/*nums = $.map(nums,function(num){
//筛选出数字 并加1
if(!isNaN(num)){
return parseInt(num)+1;
}
});*/
// 5. $.inArray() //返回在数组的多少索引,没有返回-1
//console.log($.inArray(‘2‘,nums));
// 6. $.merge() //合并
/*var att1 = [1,2,3,4];
var att2 = [4,5,6,7];
console.log($.merge(att1,att2)); //[1, 2, 3, 4, 4, 5, 6, 7]*/
// 7.$.isArray(); //判断是否是数组
/*var a = [];
console.log($.isArray(a));*/
// 8.$.isFunction(); //判断是否是方法
// 9.$.isEmptyObject() //判断是否为空对象 [] {} function(){} 0 false 空字符串 跟php中的empty()一样的
/*var a = ‘‘;
console.log($.isEmptyObject(a));*/
// 10.$.isPlainObject(); //是否是纯粹对象 纯粹对象为{},new Object();
// 11.$.contains(); //判断DOM节点是否包含另外一个DOM节点
// 12.$.type() //判断数据类型
// 13.$.isNumeric() //判断数据是否为数值
// 14.$.isWindow() //判断是否为window对象
// 15.$.param() //对象转成url键值对
/*var o = {age: 12, name: ‘zh‘};
console.log($.param(o));*/
// 16.$.proxy() //调整this的指向
标签:
原文地址:http://www.cnblogs.com/shaoshao/p/4997582.html