Array Filter
const schools = [
"Yorktown",
"Washington & Lee",
"Wakefield"
]
sample 1
const wSchools = schools.filter((school) => school[0] === 'W');
console.log(wSchools);
// ["Washington & Lee", "Wakefield"]
sample 2
const cutSchool = (cut, list) => list.filter((school) => school !== cut);
console.log(cutSchool('Washington & Lee', schools).join(' * '));
// "Yorktown * Wakefield"
console.log(schools.join('\n'));
// Yorktown
// Washington & Lee
// Wakefield
Next Example
const people = [
{ id: 1, name: 'Karen' },
{ id: 2, name: 'Bob' },
{ id: 3, name: 'Sharon' },
];
// momove Bob from array
const people2 = people.filter((person) => person.id !== 2);
confole.log(people2);