2012年4月16日
摘要: Returnstrueifvariableisundefined.如果变量没有被定义1 _.isUndefined(window.missingVariable);2 => true源码:1 _.isUndefined = function(obj) {2 return obj === void 0;3 }; 阅读全文
posted @ 2012-04-16 23:44 himanhimao 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Returnstrueif the value ofobjectisnull返回true,如果值是null对象1 _.isNull(null);2 => true3 _.isNull(undefined);4 => false源码:1 _.isNull = function(obj) {2 return obj === null;3 }; 阅读全文
posted @ 2012-04-16 23:42 himanhimao 阅读(218) 评论(0) 推荐(0) 编辑
摘要: ReturnstrueifobjectisNaN.Note: this is not the same as the nativeisNaNfunction, which will also return true if the variable isundefined.返回true如果对象是NaN, 原生函数isNaN.undefined类型也将返回true。这里将返回false1 _.isNaN(NaN);2 => true3 isNaN(undefined);4 => true5 _.isNaN(undefined);6 => false源码: _.isNaN = fu 阅读全文
posted @ 2012-04-16 23:38 himanhimao 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis a RegExp.返回true,如果是一个正则表达式1 _.isRegExp(/moe/);2 => true源码:1 _.isRegExp = function(obj) {2 return toString.call(obj) == '[object RegExp]';3 }; 阅读全文
posted @ 2012-04-16 23:31 himanhimao 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis a Date.如果对象是一个日期类型1 _.isDate(new Date());2 => true源码:1 _.isDate = function(obj) {2 return toString.call(obj) == '[object Date]';3 }; 阅读全文
posted @ 2012-04-16 23:28 himanhimao 阅读(323) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis eithertrueorfalse返回true,如果对象是bool类型1 _.isBoolean(null);2 => false源码:1 _.isBoolean = function(obj) {2 return obj === true || obj === false || toString.call(obj) == '[object Boolean]';3 }; 阅读全文
posted @ 2012-04-16 23:25 himanhimao 阅读(378) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis a finite Number.返回true如果对象是一个有限的数目1 _.isFinite(-101);2 => true3 4 _.isFinite(-Infinity);5 => false源码:1 _.isFinite = function(obj) {2 return _.isNumber(obj) && isFinite(obj);3 }; 阅读全文
posted @ 2012-04-16 23:20 himanhimao 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis a Number (includingNaN).返回true,如果是数字类型,包括NAN1 _.isNumber = function(obj) {2 return toString.call(obj) == '[object Number]';3 };源码:1 _.isNumber = function(obj) {2 return toString.call(obj) == '[object Number]';3 }; 阅读全文
posted @ 2012-04-16 23:18 himanhimao 阅读(311) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis a String返回true,如果是字符串1 _.isString("moe");2 => true源码1 _.isString = function(obj) {2 return toString.call(obj) == '[object String]';3 }; 阅读全文
posted @ 2012-04-16 23:15 himanhimao 阅读(343) 评论(0) 推荐(0) 编辑
摘要: Returnstrueifobjectis a Function返回true.如果是一个方法1 _.isFunction(alert);2 => true源码:1 _.isFunction = function(obj) {2 return toString.call(obj) == '[object Function]';3 }; 阅读全文
posted @ 2012-04-16 23:12 himanhimao 阅读(264) 评论(1) 推荐(0) 编辑