Answer the question
In order to leave comments, you need to log in
Why is the cycle repeated several times?
Hello, I need to display data, but there was a problem, the cycle repeats several times, please tell me how to fix it. I understand that fetch and map create a cycle separately, but how to avoid this and fix it? I'm new to this :-)
this.broilerDayService.fetch(this.breedId)
.subscribe(broilerDays => {
this.broilerDays = broilerDays
broilerDays.slice(0).reverse().map(item => {
console.log(this.broilerDays)
item.startDayResidue = this.residue
this.residue -= item.killingCount
this.residue -= item.deathsCount
})
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question