javascript how to check if object is date code example
Example 1: javascript detect if object is date
var myDate=new Date();
if(myDate instanceof Date){
//im a hot Date
}
Example 2: javascript check if variable is object
//checks if is object, null val returns false
function isObject(val) {
if (val === null) { return false;}
return ( (typeof val === 'function') || (typeof val === 'object') );
}
var person = {"name":"Boby Snark"};
isObject(person);//true