function isObject (item) {
return (typeof item === "object" && !Array.isArray(item) && item !== null && item!==undefined);
}
In javascript an array is also an object,
so most of the time you want to exclude the array:
function isObjectExcludeArray(obj){
return (obj === Object(obj) && Object.prototype.toString.call(obj) !== '[object Array]');
}
function isObject(val) {
if (val === null) { return false;}
return ( (typeof val === 'function') || (typeof val === 'object') );
}