javascriptの中のcallとappy

547 ワード

javacript         ,             :
<script>
    function a()
    {
         alert(this);
    }
    a();
    a.call();//             
</script>

     this          ,      window.a.call();  this     window,            :a.call("lan");  this    lan,        ,         a();  this             ,  call        ,          this   。 apply     ,    a.apply("lan",[1,"hc"]);          , call       a.call("lan",1,"hc");