The length of the array printed by console is different

project.peopleList ({

)
            "projectId": that.id
        }, function(data) {
            console.log("data",data);
            // 
            that.peopleLists = [];//push
            for(var i = data.length - 1; i>=0; i--){
                if(data[i].peopleId == that.currentPeople){
                    data.splice(i,1)
                }else{
                    that.peopleLists.push(data[i]);
                    that.$emit("update:peopleLists",that.peopleLists)
                }
            }
        })
The

interface returns three pieces of data, but the printed result is as follows:
clipboard.png
removing the for loop shows normal. If you want to know what causes this phenomenon, thank you

.
May.10,2022

do a little experiment:

clipboard.png

console.log(arr) console.log(arr.toString())devtool (3) [1, 2, 3] console.dir(arr) Array(3)

(3) [1, 2, 3] console.log arr.toString() for splice;
Array(3) console.dir arr

console.xxx arr log dir splice

console.log(JSON.stringify(arr)) watch


chormeconsoleconsolelengthforconsoledata


console.log JSON.parse(JSON.stringify(...)) debugger


, 3, 3, for1, ,2, 2; console.log("data",data)for.


,

clipboard.png

just put the mouse up and you'll know

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