How do you check if a value is an object in JavaScript?
If typeof yourVariable === 'object', it's an object or null. If you want to exclude null, just make it typeof yourVariable === 'object' && yourVariable !== null.
typeof yourVariable === 'object'
typeof yourVariable === 'object' && yourVariable !== null