Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
lodash Library k- only extract keys

I need a little help. I need to get an object from the console log and return only his keys using the lodash library, i tried

const ObjLetters = ({value}) => {
    return  _.findKey({value}) }
    console.log (ObjLetters{
        miki:"handsome",
        shon:"adorable"
        tomer:"man"})

im not aware of my problem, if its a syntax problem or maybe the wrong commands.

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Are you trying to obtain an array of keys in an object ?

If yes, try

console.log(Object.keys({
  miki: "handsome",
  shon: "adorable"
  tomer: "man",
}));

// output: ["miki", "shon", "tomer"]
about 4 years ago · Juan Pablo Isaza Denunciar

0

Ok, now my code looks like this:

const ObjLetters = ({object}) => {
    return  _.keys({object}) }
    console.log (ObjLetters({ miki:"handsome", shon:"adorable", tomer:"man"}))

but, instead of returning the keys, i get

'object'
about 4 years ago · Juan Pablo Isaza Denunciar

0

if you just want the keys you can use:

const ObjLetters = (object) => _.keys(object) 

console.log(ObjLetters({ miki:"handsome", shon:"adorable", tomer:"man"}))
// out: ["miki", "shon", "tomer"]

_ findKey find a key of the object with the values passed.

see this example from docs:

var users = {
  'barney':  { 'age': 36, 'active': true },
  'fred':    { 'age': 40, 'active': false },
  'pebbles': { 'age': 1,  'active': true }
};

_.findKey(users, { 'age': 1, 'active': true });
// out: 'pebbles'
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda