typeof x
returns a string:
"number",
"boolean",
"string",
"object" (which covers arrays too),
"function",
"undefined",
"null"
Another way is to test the constructor
property that all objects have:
if (x.constructor == String) // or Array, Number, Boolean, Object, Function
...
if (y.constructor == MyClass)
...