I have a list that looks something like this:
list = [
{ name: 'name1', age: 30 },
{ name: 'name2', age: 35 }
]
There are potentially hundreds of thousands of entries in the list.
I am executing something like this:
function myFunc(query) {
return list.filter(item => {
return item.name.includes(query)
})
}
myFunc('Hello, World!')
I want to run myFunc "in the background", and I want to be able to abort the execution of the function before it finishes its execution. How can I do that?