1、isWindow 判断的意义是什么?
2、isFunction 调用$.type 进行判断;
3、isNumeric 判断是否可转为数字类型 isNumeric(‘123’)true; isNumeric(123) true;isNumeric(NaN) false;
type 判断是否为 number 和 string,如果是字符则进行运算判断是否为NaN,返回结果;
4、isPlainObject,官方解释是是否为一个‘纯粹的对象’,就是{},或者通过new Object()创建;关于‘不纯粹的对象’,个人猜想为null??(e.g., `Object.create( null )`); 验证 $.isPlainObject($('.test')) 返回值为false;
判断依据是—— 源码还没看明白呢...
5、isEmptyObject 是否是空对象;
6、type 判断数据类型 null undefined number string boolean function object array;
function type (obj) {
if(obj === null){
return null + '';
}
// typeof obj 结果为object 的有 null, array,object;
// if(typeof obj === 'object'){
// if(Object.prototype.toString.call(obj) == '[object Object]'){
// return 'object';
// }else{
// return 'array';
// }
// }
// return typeof obj;
// 简写
return typeof obj === 'object' ? (Object.prototype.toString.call(obj) === '[object Object]' ? 'object' : 'array') : typeof obj;
}
// 源码
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
7、globalEval == DOMEval ;
8、camelCase 驼峰式写法; $.camelCase('an-gela-lll') ----- anGelaLll;
9、each,两种写法 ----$.each(obj,callBack); 或者 $().each(callBack); callBack 有两个参数,index 和 ele; 因为 $(this) 指向了 ele, 参数简写,index 放在前面;和forEach 有区别;
源码没有看懂,只知道怎么用;
10、trim 消除两端的空格,对字符进行操作;$.trim(' 123eds ');
11、makeArray 两个参数 arr ,result ; 把 arr 变成数组 和result 进行合并; 如果arr 是数组 push到result中; 如果是字符数字function....,变成数组插入到result 中;最终的数据类型有result 决定;
12、inArray 是否在数组中; 参数ele,arr,index ele 是否存在在arr 内,从index 位开始查找; 利用indexof(ele,arr,index);
13、merge
14、grep
15、map 带返回值
16、proxy
17、now
18、support