惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
TaoSecurity Blog
TaoSecurity Blog
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题
T
Troy Hunt's Blog
N
News and Events Feed by Topic
雷峰网
雷峰网
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 三生石上(FineUI控件)
Schneier on Security
Schneier on Security
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 最新话题
V
V2EX
T
Threat Research - Cisco Blogs
人人都是产品经理
人人都是产品经理
C
Cisco Blogs
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
I
Intezer
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News | PayPal Newsroom
Cyberwarzone
Cyberwarzone
B
Blog
博客园 - 聂微东
P
Palo Alto Networks Blog
A
About on SuperTechFans
The Last Watchdog
The Last Watchdog
Scott Helme
Scott Helme
Google DeepMind News
Google DeepMind News
Webroot Blog
Webroot Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
O
OpenAI News
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
A
Arctic Wolf

博客园 - 人工智能-群513704292

再出发 新的一年快开始了,学点新东西吧,从React开始(一) ECMAScript 6 Features 中文版 必须清零 彩印网的第一阶段即将收官 终于感觉掌握了一门重要的技术 程序员的命运之轮 2015年开局 2014年总结 终于理解了函数式技术 Swift来的正是时候 js的this和面向对象编程 JS正则表达式进阶 JS正则表达式基本概念 前端样板资源概览及总评 C#的前世今生,学会C#还能找到高薪工作吗? CSS基本知识6-CSS字体 CSS基本知识5-CSS对齐 CSS基本知识4-CSS行模型
js的this上下文的坑
人工智能-群513704292 · 2014-05-16 · via 博客园 - 人工智能-群513704292

很明显,this这个坑,在多层嵌套的时候还是一样被废,不管是call, apply还是bind.

例如:

var fun = function() {

this.name = 'test';

var funsub1 = function() {

var funsubsub1 = function() {

console.log(this.name);

}

...//最里层的this一样无法处理,还是window,所以使用JS,一定要牢记一层嵌套。或者在任何需要使用this的地方,使用self = this,然后使用self,最安全的做法。