<section></section>
// see https://discourse.mozilla.org/t/array-startswith-method/95965 for context
const birds = ["Parrots", "Falcons", "Eagles", "Emus", "Caracaras", "Egrets"];
// Add your code here
let index = birds.indexOf("Eagles");
if (index !== -1) {
birds.splice(index, 1);
}
function nameFun(name) {
if (name.startsWith("E")) {
return name;
}
// when using `filter` below, do not return anything
// if the above did not match.
}
const eBirds = birds.filter(nameFun);
// Don’t edit the code below here!
const section = document.querySelector("section");
section.innerHTML = "";
const para1 = document.createElement("p");
para1.textContent = eBirds;
section.appendChild(para1);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.