Question: class AntFarm { constructor ( . . . ants ) { this.ants = ants.map ( ( name ) = > ( { name, health: 1
class AntFarm
constructorants
this.ants ants.mapname name, health: ;
work
if thisants.length
return No ants here. Did you work them to death?";
this.ants.forEachant
ant.health ;
if anthealth
this.removeAntant;
;
return $thisants.length ants starting work!;
feedname
const antsToFeed this.ants.filterant ant.name name;
if antsToFeedlength
return $name not found!;
antsToFeed.forEachant
ant.health ;
;
return "Yum!";
removeAntant
const index this.ants.indexOfant;
if index
this.ants.spliceindex;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
