this指向

this

            1、普通函数this指向window

            2、有事件源的this指向事件源

            3、settimeout下this指向window

            4、对象里this指向当前对象

            /*function abc(){

                console.log(this); //abc

            }

            abc();*/

            /*document.onclick = function(){

                console.log(this); //document window

            }*/

            /*setTimeout(function(){

                console.log(this); //settimeout window

            },0)*/

            /*var a = {

                con:function(){

                    console.log(this);

                }

            }

            a.con();*/

            

            

                    

            /*       植物

                     人类 黄种人 |白种人 | 黑种人

            地球 生物 微生物

                    

                 植物

                     人类 做饭| 种树 | 砍树 | 做工具

            地球 生物 微生物

             杂交

                    

            

                        String substing,

                        Number tan

            浏览器 object Boolean tan

                        undefined

                        tan a

                                 abc

                                

                        * */

         不是所有东西都是绝对的

         //String = Number = null;

         /*String = Number;

         var a = new String('123');*/

//var a = new Number(123);

         //console.log(a);

         //alert = setTimeout = null;

         //alert(1);

         /*setTimeout(function(){

             console.log(1);

         },0)*/

         //alert = console;

         /* String.prototype.da = function(){

           return this[0].toUpperCase()+this.substr(1);

         };

         console.log('baoshu'.da());*/

        /* Object.prototype.tan = function(){

           console.log('谈谈谈');

         }

//       var a = new Number(123);

var a = new String('qwe');

         a.tan();*/

        /* function tan(){

            this.a = 123;

         }

         tan.prototype.abc = 999;

         new tan();

         console.log( new tan().abc)

         */

        /*var a = {

            name:'n'

        }

        a.substring(1);*/

        

        /*function a(x,y,z){

            this.k = 12;

            //console.log(this,x,y,z);

        }*/

        //a.call(1,2,3,4);

        //a.apply(1,[2,3,4]);

        /*function b(){

            a.apply(this);

        }

        console.log(new b().k)

    */

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值