If I have two array
A = [ "B,C,D"
"W,F,G"
"M,S,E"
]
D = [E]
and want to compare D OR G with E (I mean the third one in each line)and If they are equal can show all the line for me. The third one in each line a part of each line and I want just compare the third one If it is equal show that line have equal variable . I wrote this code but didn't give me the response that I need have :
for(var k=0 ; k<A.length ; k++){
if(A[k].split(",")[2] === E) {
finalSuccessServices = A;
console.log(finalSuccessServices );
}
How can I improve my code to get that line that have my equal variable?
E? Why are you settingfinalSuccessServices = A, whenAnever changes anyways? Did you meanA[k]?