首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

判断变量是不是是日期类型

2012-10-06 
判断变量是否是日期类型function testObjectType(val) {var tswitch(val) {??? case null: t null b

判断变量是否是日期类型

function testObjectType(val) {
var t;
switch(val) {
??? case null: t = "null"; break;
??? case undefined: t = "undefined"; break;
??? default:
??????? t = Object.prototype.toString.call(val).match(/object\s(\w+)/)[1];
??????? break;
}
return? t.toLowerCase();
}

?

?

如果是日期类型则返回值是"date"

热点排行