-1

I am simply trying to access an object which name starts with ':' from the Javascript console.

Here is how the object looks like and I want to access escrow:

{
   'compiled': 
   {
      'contracts':
       { 
          ':escrow':   
           { assembly: { 
              '.code': [Array], 
              '.data': [Object] 
           }
       }
    }
}

Here is how I am trying, but always get a undefined error message:

compiled.contracts.escrow
str
  • 42,689
  • 17
  • 109
  • 127
0xtuytuy
  • 1,494
  • 6
  • 26
  • 51

1 Answers1

1

When a property name is not a valid identifier (something that would work as a variable name), the property must be accessed with the [ ] operator:

compiled.contracts[":escrow"]

The [ ] operator otherwise does exactly the same thing as . in chain of object property references.

Pointy
  • 405,095
  • 59
  • 585
  • 614