Question: class AntFarm { constructor ( . . . ants ) { this.ants = ants.map ( ( name ) = > ( { name, health: 1

class AntFarm {
constructor(...ants){
this.ants = ants.map((name)=>({ name, health: 100}));
}
work(){ let antsCount = this.ants.length
if (antsCount===0){
return ["0 Ants starting work!","Did you work them to death?"]
}
for (let i =0; i ant.name === name);
if (antsToFeed.length ===0){
return `${name} not found!`;
}
for (const ant of antsToFeed){
ant.health +=15;
}
return "Yum!";
}
}class AntFarm {
constructor(...ants){
this.ants = ants.map((name)=>({ name, health: 100}));
}
work(){ let antsCount = this.ants.length
if (antsCount===0){
return ["0 Ants starting work!","Did you work them to death?"]
}
for (let i =0; i ant.name === name);
if (antsToFeed.length ===0){
return `${name} not found!`;
}
for (const ant of antsToFeed){
ant.health +=15;
}
return "Yum!";
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!