arrays4-download

MDN javscript

by madefromjames

HTML

<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>Arrays: Task 4</title>
    <style>
      p {
        color: purple;
        margin: 0.5em 0;
      }

      * {
        box-sizing: border-box;
      }
    </style>
    <link rel="stylesheet" href="../styles.css" />
  </head>

  <body>

    <section class="preview">



    </section>

  </body>
</html>

JavaScript

const birds = [ "Parrots", "Falcons", "Eagles", "Emus", "Caracaras", "Egrets" ];

    // Add your code here

    const newBirds = birds.indexOf("Eagles");
    birds.splice(newBirds, 1);

    function newArray(birds) {
        return birds.startsWith("E");
    }

    const eBirds = birds.filter(newArray)

    console.log(eBirds);


    // Don't edit the code below here!

    const section = document.querySelector('section');

    const para1 = document.createElement('p');
    para1.textContent = eBirds;

    section.appendChild(para1);