我一直不是很明白为什么有的代码toString.call(r)会这样写,有什么好处吗?谢谢,非常感谢

解决方案 »

  1.   

    每个对象都有toString();方法,r是个什么对象?
      

  2.   

    lz看看这个
    http://hi.baidu.com/emptykid/blog/item/d3f4f6fbd04d31d7b58f316d.html
      

  3.   

    toString()是Object prototype中的属性。每个对象(包括function对象)都会集成这个属性。
    call方法主要是在调用call的function内部,this都是指代call()的参数,即r.
    r.toString()和toString.call(r)应该没有区别
      

  4.   


    啊啊啊 那var arr = [1,2,3];alert(arr.toString()) ;alert(toString.call(arr)) ;这个咧?越看越糊涂啊
      

  5.   

     Object.prototype.toString.call()
      

  6.   

    var toString = Object.prototype.toString;
    var type = toString.call(r);
    alert(type);
    jquery中用这种方法判断对象类型,因为typeof不起作用
      

  7.   

    LZ得明白call是什么意思,
    相当于
    r.m = toString;
    r.m();
    delete r.m;