Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to filter nested array of objects in javascript

let output = fruitData.filter(eachVal => {
            let opt = eachVal.details.some((
                { gradingDetails }) => gradingDetails
                .some(({ grade }) => grade === 'A'));
            return opt;
        })
        console.log(output);
        document.getElementById("Output").innerHTML =
            JSON.stringify(output);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #filter #nested #array #objects #javascript
ADD COMMENT
Topic
Name
7+3 =