Inaccessible JavaScript JavaScript property. Why does Firebug show this?

So, I'm trying to access the contents of an object, and for me life cannot understand why I cannot. I'm starting to believe that an object does not have properties that Firebug indicates what it does. Most likely, I just do not use the correct syntax to access them.

Give the following function:

function(userData) {
    console.log(userData);   // statement 1
    console.log(userData.t_nodecontent); // statement 2
}

What generates the following FireBug output for statement 1

image

and undefinedfor approval 2. (Note: Initially incorrectly stated, what I saw unknown)

Is there something obvious that I'm losing sight of how I try to refer to a value t_nodecontent? I am at a loss: (

+3
source share
3 answers

unknown , -, , ActiveXObject IE.

, undefined

, , , ECMAScript.

+2

:

for(var key in userData){
   console.log(key, userData[key]);
}
+1

The problem, you will find, is that userData is actually [userData]! Try accessing userData [0]. I was caught this way before (the last time today with the object property of the Dojo.Data element) ... if the object is passed in an array, Firebug displays the first element of the array, not the array itself.

+1
source

Source: https://habr.com/ru/post/1748397/


All Articles