I have a simple if else code in TypeScript.But in some code unable to access it.It shows me the following error,
"Cannot read properties of undefined (reading 'setNewsProvider')"
Code
 if (this.newsShow != null) {
        if (this.glbNews.nIds == null) { 
            this.setNewsProvider(); //Accessible Here
        }
        else {
            if (this.newsShow.EmpLst == null) { 
                this.setNewsProvider(); // Accessible Here
            }
            else {
                if (this.newsShow.LCL == "X300") {
                    if (this.newsShow.MXD == "N300") {
                        var prd1 = this.newsShow.ProducerChk;
                        this.glbNews.PrdNcc.forEach(function (value) {
                            if (value == prd1) {
                                this.setNewsProvider(); //Un accessible here.. "Cannot read properties of undefined (reading 'setNewsProvider')"
                            }
                        })
                    }
                    else {
                       //Some code here
                        })
                    }
                }
              
            }
        }
    }