0
value =   {
     5c03dbc3d8e3e3435f875a46: "1", 
     5c03dc0fd8e3e3435f875a48: "2", 
     5c03dc30d8e3e3435f875a49: "3", 
     5c03dc5fd8e3e3435f875a4a: "4"
     }

I have an array like this. I want to get key from this array, so that I can use it to get values associated with those keys. This all is for typescript.

Saurabh Verma
  • 119
  • 2
  • 2
  • 11

1 Answers1

4

You don't have an array, you have an object literal. If it were an array, you would use brackets [ ] instead of curly braces { }. Also, array keys are always integer numbers from 0 to length -1.

To answer your question. If you want all keys from your value object, you can use Object.keys(value).

Martin Häusler
  • 6,544
  • 8
  • 39
  • 66