Ho can i find a name inside at another string?

i want to find a substring in another string, in this time i am getting only one appear but it should reject the numbers in the middle of the name

const copyies = [{name:'297huosaabc.jpg'}, {name:'268hdjsaabc1.jpg'}, {name:'237hdjsaabc2.jpg'}, {name:'237hdjsaabc2ui.jpg'}]
const findName = 'abc.jpg'
const amount = copyies.filter(elem => elem.name.includes(findName))
console.log('amount', amount)
the result should be 3

Read more here: https://stackoverflow.com/questions/67374258/ho-can-i-find-a-name-inside-at-another-string

Content Attribution

This content was originally published by display at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: