मैं निम्न सरणी
[{ id: 1,
type: 'video',
image: null,
url: 'https://www.youtube.com/1'
},
{ id: 2,
type: 'video',
image: null,
url: 'https://www.youtube.com/2'
},
{ id: 3,
type: 'image',
image: 'https://example-1.url.webp'
},
{ id: 4,
type: 'image',
image: 'https://example-2.url.jpg',
},
{ id: 5,
type: 'video',
image: 'https://www.youtube.com/2',
}
]
मैं पहले से ही छानने सभी आइटम नहीं हैं, जो webp प्रारूप और छवि है null
const galleryFilter = gallery.filter(
(item) => item?.image?.indexOf("webp") === -1 || item?.image === null
);
के रूप में आप देख सकते हैं वहाँ 2 items
(आईडी 2 और आईडी 5 ) के साथ एक ही यूआरएल, कैसे कर सकते हैं मैं भी फिल्टर आइटम के साथ दोहराया एक ही url में galleryFilter
विधि ?