Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript filter

const selected = [
    {
        "id": "d89a16e9-12cf-4365-9709-b92f22c03b47",
        "selected": true
    },
    {
        "id": "def36273-0ffa-439b-bbbb-5ffa6afb65a4",
        "selected": false
    },
    {
        "id": "e783f7a0-88f3-4224-94fc-f778c405d787",
        "selected": true
    }
]

selected.filter((item) => item.selected)
console.log(selected)
// Result
[
    {
        "id": "d89a16e9-12cf-4365-9709-b92f22c03b47",
        "selected": true
    },
    {
        "id": "e783f7a0-88f3-4224-94fc-f778c405d787",
        "selected": true
    }
]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #filter
ADD COMMENT
Topic
Name
2+3 =