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

112
Views
Mapping array in javacript app in a react app

This is my array, I'm working on react app

const categoryObj = [
    {
        id: "463e989a-c4f2-4616-85c5-0cb610c5fff0",
        name: "Women",
        subCategory: [
            {
                id: "91ba7308-b68e-4d0c-85d8-0cc8272c6bc8",
                name: "All",
                icon: "AllIcon"
            },
            {
                id: "0e0712c5-0b5a-4d4e-acf5-3d7faf2caa2a",
                name: "Clothes",
                icon: "ClothesIcon",
                sections: [
                    {
                        id: "9b7a7a58-04a1-4aba-ba68-0e6b1390021e",
                        name: "All",
                        href: "Women/Clothes/All".split(' ').join('-').trim().toLowerCase()
                    }
                ]
            }
        ]
    }
]

how can I access "women" in this array ? (I have many items like "women" this is just a sample of a large array. if you can suggest a mapping method it's better.)

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

0

You can map through it to get the name value in this way:

categoryObj.map((category) => category.name)
about 4 years ago · Juan Pablo Isaza Report

0

const categoryObj = [
    {
        id: "463e989a-c4f2-4616-85c5-0cb610c5fff0",
        name: "Women",
        subCategory: [
            {
                id: "91ba7308-b68e-4d0c-85d8-0cc8272c6bc8",
                name: "All",
                icon: "AllIcon"
            },
            {
                id: "0e0712c5-0b5a-4d4e-acf5-3d7faf2caa2a",
                name: "Clothes",
                icon: "ClothesIcon",
                sections: [
                    {
                        id: "9b7a7a58-04a1-4aba-ba68-0e6b1390021e",
                        name: "All",
                        href: "Women/Clothes/All".split(' ').join('-').trim().toLowerCase()
                    }
                ]
            }
        ]
    },
    {
        id: "463e989a-c4f2-4616-85c5-0cb610c5fff0",
        name: "Men",
        subCategory: [
            {
                id: "91ba7308-b68e-4d0c-85d8-0cc8272c6bc8",
                name: "All",
                icon: "AllIcon"
            },
            {
                id: "0e0712c5-0b5a-4d4e-acf5-3d7faf2caa2a",
                name: "Clothes",
                icon: "ClothesIcon",
                sections: [
                    {
                        id: "9b7a7a58-04a1-4aba-ba68-0e6b1390021e",
                        name: "All",
                        href: "Women/Clothes/All".split(' ').join('-').trim().toLowerCase()
                    }
                ]
            }
        ]
    },
    {
        id: "463e989a-c4f2-4616-85c5-0cb610c5fff0",
        name: "Children",
        subCategory: [
            {
                id: "91ba7308-b68e-4d0c-85d8-0cc8272c6bc8",
                name: "All",
                icon: "AllIcon"
            },
            {
                id: "0e0712c5-0b5a-4d4e-acf5-3d7faf2caa2a",
                name: "Clothes",
                icon: "ClothesIcon",
                sections: [
                    {
                        id: "9b7a7a58-04a1-4aba-ba68-0e6b1390021e",
                        name: "All",
                        href: "Women/Clothes/All".split(' ').join('-').trim().toLowerCase()
                    }
                ]
            }
        ]
    }
]
const result = categoryObj.filter(obj => obj.name === 'Women')
console.log('multi objects :', result)
// if unique with name 
const resultUnique = categoryObj.find(obj => obj.name === 'Women')
console.log('unique object :', resultUnique)

about 4 years ago · Juan Pablo Isaza Report

0

const res  =  categoryObj.filter(item=>item.name === 'Women');
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!