To clarify my title, I need a way to determine that an object is not a String, Number, Boolean, or any other predefined JavaScript object. One method that comes to mind is this:
if(!typeof myCustomObj == "string" && !typeof myCustomObj == "number" && !typeof myCustomObj == "boolean") {
I could check to see if myCustomObj
is an object, like this:
if(typeof myCustomObj == "object") {
This only works for primitive values, though, as this typeof new String("hello world") == "object")
is true.
What is a reliable way to determine whether or not an object is not a predefined JavaScript object?