instanceof用于判断一个变量是否某个对象的实例

解决方案 »

  1.   

    知道就可以
    http://en.wikibooks.org/wiki/JavaScript/Variables_and_TypesPrimitive Types: Boolean Type Numeric Types String Types
    Complex Types : A complex type is an object, be it either standard or custom made.var Str1 = new String("hello Js");
    var Str2 = "hello Js";var $a = Str1 instanceof String
    var $b = Str2 instanceof Stringvar $c = typeof Str1;
    var $d = typeof Str2;