//普通函数 // function f1() { // console.log(this); // } // f1();
//定时器中的this // tinterval(function () { // console.log(this); // },1000);
//构造函数 /铁岭师范高等专科学校/ function person() { // console.log(this); //对象的方法 // this.sayhi=function () { // console.log(this); // }; // } //原型中的方法 // person.prototype.eat=function () { // console.log(this); // }; // var per=new person(); // console.log(per); // per.sayhi(); // per.eat();
//严格模式: "u strict";//严格模式 function f1() { 古诗静夜思console.log(this);//window } 好的画室 fti6开幕式1();
本文发布于:2023-04-03 11:17:53,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/8509807948bd64aa2a732fa86154ebfc.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:JavaScript之函数中的this和严格模式.doc
本文 PDF 下载地址:JavaScript之函数中的this和严格模式.pdf
留言与评论(共有 0 条评论) |