I have two arrays:
operator.permanent tab has screen ids and the screens array has id,
I need to create a repeat structure that compares the two arrays and printe the screen name.
I tried something like:
My array operator.table_perm:
(4) [1, 3, 9, 5]
0: 1
1: 3
2: 9
3: 5
length: 4
My screens array:
0: {id: 1, nome_tela: "Cadastrar Operador", created_at: null}
1: {id: 2, nome_tela: "Tipo do Produto", created_at: null}
2: {id: 3, nome_tela: "Produtos", created_at: null}
3: {id: 4, nome_tela: "Custos Fixos", created_at: null}
4: {id: 5, nome_tela: "Custos Variáveis", created_at: null}
5: {id: 6, nome_tela: "Custos Extras", created_at: null}
6: {id: 7, nome_tela: "Listagem dos Custos Fixos", created_at: null}
The operator.table_perm array has the IDS of the screens as values. The screen array has id and name, I need to name the screens that exist in the table_perm.
for(let i=0; i<this.operador.tabela_perm.length; i++){
for(let j=0;j<this.operador.tabela_perm.length; j++){
if(this.operador.tabela_perm[i] == this.telas[j].id){
console.log(this.telas[j].nome_tela)
}
}
}
}