Answers for "check javascript object not array and not null"

0

check javascript object not array and not null

function isObject (item) {
  return (typeof item === "object" && !Array.isArray(item) && item !== null && item!==undefined);
}
Posted by: Guest on July-28-2021
0

check javascript object not array and not null

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]');
}
Posted by: Guest on July-28-2021
0

check javascript object not array and not null

function isObject(val) {
    if (val === null) { return false;}
    return ( (typeof val === 'function') || (typeof val === 'object') );
}
Posted by: Guest on July-28-2021

Code answers related to "check javascript object not array and not null"

Code answers related to "Javascript"

Browse Popular Code Answers by Language