If the typeof yourVariable === 'object,' it is either an object or null.
If you wish to exclude null, arrays, or functions, just type:
if (
typeof yourVariable === 'object' &&
!Array.isArray(yourVariable) &&
yourVariable !== null
) {
executeSomeCode();
}