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

166
Views
How to make Object value to Object property in JavaScript

I have an Object named category. Here the property/keys are in short-form and the value is in fullform. I need to assign Object property/keys to Object value for a short time moment.
Like.

'Technology' have to make tech

const category = {
    tech: 'Technology',
    gnr: 'General',
    ent: 'Entertainment',
    sci: 'Science',
}
let a 
a=Object.values(category).map(i=>{
 Object.keys(category).map(j=>{
   i=j
 })
})
console.log(a)

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

const categories = {
    tech: 'Technology',
    gnr: 'General',
    ent: 'Entertainment',
    sci: 'Science',
}

const predicate = 'General';

let match;

for (const category in categories) {
    if (categories[category] === predicate) {
        match = category;
    }
}

console.log(match);

about 4 years ago · Juan Pablo Isaza Report

0

let a = {};
for (let key in category)
{
    a[category[key]] = key;
}

or

let a = {};
Object.entries(category).forEach(kv=>a[kv[1]]=kv[0]);

about 4 years ago · Juan Pablo Isaza Report

0

Nope! Now after getting match with parameter that I will pass, I need that matching parameter Object Value's Property/Keys.
Like, If General Match then I need gnr
Here I am getting 'General' but I need gnr

const category = {
    tech: 'Technology',
    gnr: 'General',
    ent: 'Entertainment',
    sci: 'Science',
}
let a 
a=Object.values(category).filter(i=>{
  if(i=='General')  {
return Object.keys(i)
  }
 
})
console.log(a)

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!