jquery – javascript, is there an isObject function like isArray?
jquery – javascript, is there an isObject function like isArray?
You can use typeof operator.
if( (typeof A === object || typeof A === function) && (A !== null) )
{
alert(A is object);
}
Note that because typeof new Number(1) === object
while typeof Number(1) === number;
the first syntax should be avoided.
use the following
It will return a true or false
theObject instanceof Object
jquery – javascript, is there an isObject function like isArray?
In jQuery there is $.isPlainObject()
method for that:
Description: Check to see if an object is a plain object (created
using {} or new Object).