In this question I did not see suggestions to use constructor.
So instead of
typeof callback == "function"
callback && (callback.constructor==Function)
undefined === undefined
null === null
[1,2,3].constructor == Array
(1).constructor == Number
(true).constructor == Boolean
(()=>null).constructor == Function
'abc'.constructor == String
(new Date()).constructor == Date
else it's an object, where instanceof helps to detect it's parents if needed.
instanceOf is better because it works with inherited constructors.
.constructor is a mutable property on an object, so it's not a good thing to check because one can simply change it. You can't change the
const x = new Date(); console.log("Date Constructor", x.constructor); x.constructor = "herpderpderp"; console.log("Date Constructor", x.constructor);