当前位置:网站首页>this指向问题
this指向问题
2022-07-31 05:11:00 【抱抱旋旋子】
this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定this到底指向谁,一般情况下this的最终指向的是那个调用它的对象
现阶段,我们先了解一下几个this指向
1.全局作用域或者普通函数中this指向全局对象window(注意定时器里面的this指向window )
在定时器方法的第一个参数的函数中,this指向的也是window对象
2.在方法中,谁调用的方法,this就指向谁

3.构造函数中的this指向的是新创建的实例

边栏推荐
- 2021年京东数据分析工程师秋招笔试编程题
- gin框架学习-Casbin进阶之策略管理API使用方法
- 什么是EVM兼容链?
- Understanding SSRF, this article is enough
- leetcode-438. 找到字符串中所有字母异位词(滑动窗口)
- gin框架学习-Casbin入门指南(ACL、RBAC、域内RBAC模型)
- [Elastic-Job source code analysis] - job listener
- The server time zone value ‘й‘ is unrecognized or represents more than one time zone
- 代码块、Package,Import,封装(第六天)
- [Elastic-Job] Overview of Distributed Scheduling Tasks
猜你喜欢
随机推荐
The process and specific code of sending SMS verification code using flask framework
About integrating superset into your own project
Three-party login using wallet Metamask based on web3.0
数据库 | SQL增删改查基础语法
Several solutions for mysql startup error The server quit without updating PID file
gin框架学习-GORM框架进阶之CRUD接口(数据库增删改查操作)
字符串的新增方法
NFT:数字所有权的核心
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
碎片化NFT(Fractional NFT)
C language tutorial (1) - preparation
(Crypto essential dry goods) Detailed analysis of the current NFT trading markets
MySQL-如何分库分表?一看就懂
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
leetcode-438. 找到字符串中所有字母异位词(滑动窗口)
vulhub靶场学习日记hackme2
通信原理——纠错编码 | 汉明码(海明码)手算详解
C language tutorial (2) - printf and data types that come with c
leetcode-每日一题558. 四叉树交集(分治递归)
代码块、Package,Import,封装(第六天)









