I want to filter an array of files by their extensions. I have written following code:
const exts = ['.log, ts']
const files = [
'a.ts', 'b.xml', 'c.log'
]
const res = files.filter(f => {
return exts.some(e => {
return f.endsWith(e)
})
})
console.log(res)
In my opinion, it should output['a.ts', 'c.log'].
But I get an empty array.
I am looking at this since hours. I don't get it. Please help me.. What's wrong ?