Hello

I like me create a bus routing finder, only City A (origin), City B (origin), search for the same routes in the cities and show the result

For example
City A - linebus 1, linebus 3, linebus 5
City B - linebus 1, linebus 3, linebus 10

Then should be show 1 and 3 can connect this cities

I found this script online, I dont know it is possible use for my problem or adapt

var city_A= ["bus1", "bus3", "bus5"]
var city_B= ["bus1", "bus3", "bus10"]

for(var i = 0; i<arr1.length; i++){
for(var j=0; j<arr2.length; j++){
if(arr1[i] === arr2[j]){
//do something
}
}



Or is wrong?

Thanks