The problem of the value of function

dataApi:function(callback){
                var datax = [];
                this.getApi(function(data){
                    data.subjectCategorys.forEach(function(el){
                        var CategoryId = el.subjectCategoryId;
                        this.startIndex = 0;
                        this.pageSize = 20;
                        this.subjectId = el.subjectId;
                        var params = {startIndex:this.startIndex,pageSize:this.pageSize,subjectId:this.subjectId,subjectCategoryId:CategoryId}
                        huiguPost(function(data){
                            if(data.code == 0){
                                callback&&callback(data.data);
                            }else{
                                utils.Errordata();
                            }
                        },"http://develop.huiguqx.com/thirdpartyapi/subject/querySubjectArticles", params);
                        datax.push(el.subjectCategoryId);
                    })
                });
            },

how do I get the value of datax in dataApi when I want to get it outside?

Apr.02,2021

I see you define callback, and you can pass it to your callback

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a3ea-2c210.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a3ea-2c210.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?