Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!