How to Check If a Value is an Object in JavaScript
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Use the
typeof
OperatorYou can use the
typeof
operator to check whether a value is an object or not in JavaScript. But, thetypeof
operator also returns "object" fornull
and arrays, so we need to consider that too.Here's an example which offer a simple solution to this problem:
need an explanation for this answer? contact us directly to get an explanation for this answer