Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
 
PREVIOUS NEXT
Tagged: #javascript #check #variable #object
ADD COMMENT
Topic
Name
9+1 =