Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check if variable is object

let myObject = {
	firstname: 'harry',
  	lastname: 'potter'
}
//check the typeof if, boolean, object, string etc...
console.log(typeof myObject);
if(typeof myObject === 'object') {
	console.log('this is object');
}
 
PREVIOUS NEXT
Tagged: #javascript #check #variable #object
ADD COMMENT
Topic
Name
5+6 =