published: 08 Oct 2022
1 min read
A cool little snippet to remove items from an array
const urls = [ "image.jpg", "image.jpeg", "image.png", "image.webp", "image.svg", "image.gif", ]; const result = urls.filter((url) => /\.(jpe?g|png|webp)$/.test(url)); console.log(result);
Are we missing something? Help us improve this article. Reach out to us.
A cool little snippet to remove items from an array
const urls = [ "image.jpg", "image.jpeg", "image.png", "image.webp", "image.svg", "image.gif", ]; const result = urls.filter((url) => /\.(jpe?g|png|webp)$/.test(url)); console.log(result);
Are you looking for other code tips?
Check out what's on in the category: javascript, programming
Check out what's on in the tag: javascript, programming
TipsAndTricksta
I love coding, I love coding tips & tricks, code snippets and javascript