I
I
Ilnar Kamaletdinov2018-10-21 00:32:20
JavaScript
Ilnar Kamaletdinov, 2018-10-21 00:32:20

How to get the desired key from a large object?

how to display in innerHtml or in console.log, for example, from the mouse the enemy key, tell me please =D

{
  "Мышь": {
    "Враг": 10234,
    "Популяция":400023143 ,
    "Вредительство": 8000 ,
    "Польза": 0 ,
    "символ": "=::="
  },
  "Кот": {
    "Враг": 10235,
    "Популяция":223123123 ,
    "Вредительство": 1000 ,
    "Польза": 1 ,
    "символ": ":3"
  },
  "Собака": {
    "Враг": 10235,
    "Популяция":242563788 ,
    "Вредительство": 1000 ,
    "Польза": 1 ,
    "символ": "[email protected]="
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Egorov, 2018-10-21
@pevasik

o["Мышь"]["Враг"];
// или
o.Мышь.Враг;

and you don't have commas after the "Mouse" and "Cat" objects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question