Filtering a list of email addresses
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']
no comments