console.log(object) shows property and its value, but that property is not actually a key?

1.1k Views Asked by At

I have an object with multiple properties, one of which is 'lane' with a value of 1. console.log(myObject), shows the property and its value are there. However, if I try to access it myObject.lane, it is'undefined'. Also - if I print the keys of the object with Object.keys(myObject), the array has all of the properties EXCEPT "lane"! I really don't know what else to do, or what kind of problem could cause this.

//actual code (in a React Redux reducer... which shouldn't matter in my opinion)
      console.group("What is happening?");
      console.log("myObject", myObject);
      console.log(
        "you can clearly see that 'lane' in is myObject with value of number 1."
      );
      console.log("Object.keys(myObject)", Object.keys(myObject));
      console.log("But somehow, 'lane' is not a key in myObject");
      console.log("MyObject again", myObject);
      console.log("myObject.lane is undefined? : ", myObject.lane);
      console.log("Other keys work, like myObject.alpha : ", myObject.alpha);
      console.groupEnd();

Here is a picture of the output of the console.

enter image description here

What can cause an object to console.log a property and its value, but not actually be a key?

0

There are 0 best solutions below