Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)DA
Posts
0
Comments
1
Joined
2 yr. ago

  • If you're not married to functional code, for searching a keyed object by property for the key, you can always write:

     js
        
    for (const key in data) {
      if (data[key].firstName === 'Frederic') {
        console.log(key);
      }
    }
    
    
      

    No need to transform the whole object with Object.entries, and you could turn that into a function reasonably easy, something like findKey(object, property, value) or some such.