Is there any way the data of forEach
can be viewed outside of forEach
?
I need to view the forEach
data outside of it, but every time I do this it only returns the last data, not all data. I've already tried using localStorage
and the same result.
If it does not, is there any way to do a forEach
with two arrays? Could you give examples?
My code:
this.MetaService.CheckOrderGet().subscribe(
data => {
const pesquisa = (data as any)
this.check = JSON.parse(pesquisa._body)
this.check.forEach(apielement => {
this.fil.forEach(dados=> {
if (apielement.FI == dados.FI) {
console.log('Dados iguais ${apielement.FI}');
}else{
console.log('Diferentes ${apielement.FI}');
}
})
}
)