1//checks if is object, null val returns false
2function isObject(val) {
3 if (val === null) { return false;}
4 return ( (typeof val === 'function') || (typeof val === 'object') );
5}
6var person = {"name":"Boby Snark"};
7isObject(person);//true
1typeof date.getMonth === 'function'
2// you can use the instanceof operator, i.e. But it will return true for invalid dates too, e.g. new Date('random_string') is also instance of Date
3date instanceof Date
4// This will fail if objects are passed across frame boundaries.
5// A work-around for this is to check the object's class via
6Object.prototype.toString.call(date) === '[object Date]'