Function that traverses object within object and returns value in Javascript [duplicate]

0

I have a huge object with several other objects inside, similar to the example below

const Carro = {
        GM : {'Corsa':'Motor MPFI',
             'Celta':'Motor VHC'},
Volkswagen : {'Gol':'Motor AP',
              'UP':'Motor TSI'}
}

I want to know how to do a function to chamala as follows

funçao(Carro,"Motor MPFI")

It returns me "GM, Corsa", that is, the key that has the value "Motor MPFI" and the object to which it belongs.

    
asked by anonymous 10.09.2018 / 21:04

0 answers