I'm trying to filter this
Alert me when this account’s current balance goes above $1.
from the list here:
alertTypes = [
'Alert me when this account’s available balance goes below $1.',
'Alert me when this account’s current balance goes below $1.',
'Alert me when this account’s available balance goes above $1.',
'Alert me when this account’s current balance goes above $1.']
Using this async function
const alertRegEx = "/.*current balance.*above.*/"
const alert = alertTypes.filter(alert => alert.match(alertRegEx))
But im getting the whole list in alert variable. What's my mistake here?
async/await? There is no asynchronous code here. Moreover, you cannot use an async function for a.filter()predicate.