Questions about the properties of JS objects

wrote such a method:

                        //
                        for(let i=0;i<this.logData.length;iPP){
                            let address=this.logData[i].id;
                            this.$http(api_member_ship_department,address)
                            .then(res => {
                                //
                                this.logData[i].apr=res;
                            })
                            .catch(code => {
                            this.$message({ type: "error", message: code.message || code });
                            });
                        };

roughly means to request everyone"s department information from the background and add it as an apr attribute to the existing object logData,. The added logData output looks like this:

then I loop out the attribute value of each apr:

for(let i=0;i<this.logData.length;iPP){console.log(this.logData[i].apr)} 

the result is all undefined, which makes me puzzled. I ask God for advice

Mar.07,2022

your process of taking values is asynchronous. I think the possible problem is that when you loop out the attribute value of each apr , this.logdata [I] .apr actually doesn't get the callback data

.
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-1e45db6-43895.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-1e45db6-43895.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?