怎么理解这道题的

https://www.nowcoder.com/questionTerminal/ebb10dcc642e4abdba41edf3fc8c8515
看了这道题,没太理解
function test() {
            this.flag = false;
            this.change = () => {
                // console.log(this) //test
                this.flag = true;
                console.log("button.flag",button.flag); //true
            };
        }
        const button = new test();
        document.addEventListener("click", button.change);

        function btn(){
            const button2 = new test()
            console.log("button2.flag",button2.flag) //false
        }
求大神解释

#求助#
全部评论
牛客的题貌似都是带解析的吧
点赞 回复 分享
发布于 2022-07-27 16:06

相关推荐

合不合适,我自己说了才算
码农索隆:hr:“真执着啊,来我公司当法人吧”
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-11 11:29
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:10
直接上图
牛客13578115...:改得一般,不值80
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务