If there is an attribute in the helper js object whose value is 0 of type number, this property disappears, and if you change 0 from number to a string, it exists.

clipboard.png

clipboard.png

Apr.28,2022

console.log typed out a reference, and the expanded content may change, but the top line is a snapshot
your case shows that the key delete with attribute number 0 somewhere in the code after console.log


for (var i in data) {
                        if (data[i] == "") {
                            delete data[i]
                        }
                    }

has found the reason, because the following code clears the empty string using = = will clear 0, too, and change it to =. Now there is a new question, why does the following code affect the above, doesn't js execute from top to bottom


try console.log (JSON.stringify (data)) to see the current data property, but convert it to a string

Menu