怎么理解这道题的

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

相关推荐

在看牛客的社畜很积极:身高体重那一行信息去掉,学校那一行的信息放上面,找半天都没找到你是哪个学校什么专业的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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