instanceof false , , Array .
instanceof , , ( String, scunliffe). , , - instanceof Object ( Array); String .
, switch , :
function classify(arg) {
return Object.prototype.toString.call(arg);
}
, toString Object, ( , , , , -). , :
function show(arg) {
alert(classify(arg));
}
:
show({}); // [object Object]
show("a"); // [object String]
show(new String("a")); // [object String]
show([]); // [object Array]
show(/n/); // [object RegExp]
show(function() { }); // [object Function]
, , , , String.