怎么理解这道题的

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

相关推荐

10-16 11:21
门头沟学院 Java
xdu通信dddd:我小米都面完两个月了 八月底面完的,现在还是显示面试中,没有比我恐怖的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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