Filtering a list of email addresses

node v14.20.1
version: 1.0.0
endpointsharetweet
const emailList = ['john@gmail.com', 'sarah@yahoo.com', 'tim@gmail.com']; const filteredEmails = []; for (let email of emailList) { if (email.includes('gmail')) { filteredEmails.push(email); } } console.log(filteredEmails); // Output: ['john@gmail.com', 'tim@gmail.com']
Loading…

no comments

    sign in to comment