-2
Good afternoon.
I ask you kindly to help me in a simple problem (for you kkk), but that is bothering me.
I have a fixed matrix (values are taken from a txt)
need a return function another matrix where a value passed per parameter is equal to the value of the second column of the matrix.
function retornaBusca(palavra, matriz){
let result
for (i = 0; i < matriz.lenth; i++){
if( matriz[i][1] == palavra ){
result.push(matriz[i][0] +'#'+matriz[i][1]
}
}
return result
}
Ex:
matriz[0][1] = ['josé']
matriz[1][1] = ['pedro']
matriz[2][1] = ['joão']
matriz[3][1] = ['josé']
if I called
mat = retornaBusca('josé', matriz)
I hoped you’d return
mat[0] = 123#josé
mat[1] = 456#josé
Thank you very much
Where is
let result
dolet result = [];
and where isresult.push(matriz[i][0] +'#'+matriz[i][1]
doresult.push(matriz[i][0] +'#'+matriz[i][1]);
– Augusto Vasques