Endangered Species

jQuery JavaScript Selectors Public



An HTML div element contains lists of endangered species grouped by continent and the species population status.

    <ul data-continent="North America">
        <li data-species="California condor">Critically Endangered</li>
        <li data-species="American bison">Near Threatened</li>
    <ul data-continent="Europe">
        <li data-species="Cave bear">Extinct</li>

Write a function that returns how endangered a species is on a particular continent. For example endangeredSpecies('North America', 'American bison') would return 'Near Threatened'.

ECMAScript 6, jQuery v3.2.1 (available as $)

  •   Example case: Wrong answer
  •   Several species and continents: Wrong answer
  •   Continents with the same species: Wrong answer