On the problem of js Array matching

pick out the matching route through the boarding point selected by the user

let  data=[
  {
    name:"a",
    line:[
      {type:"up",place:""},
      {type:"up",place:""},
      {type:"up",place:""},
      {type:"down",place:""},
      {type:"down",place:""}
      ]
  },
  {
    name:"b",
    line:[
      {type:"up",place:""},
      {type:"up",place:""},
      {type:"up",place:""},
      {type:"down",place:""},
      {type:"down",place:""}
      ]
  },
  {
    name:"c",
    line:[
      {type:"up",place:""},
      {type:"down",place:""},
      {type:"down",place:""}
      ]
  },
  ]
let upName=""
let downName=""

data upName  downName 
 

data.forEach(function (item) {
    item.line.forEach(function (val) {
      if(val.type==="up" && val.place===upName){
        
      }
    })
  })

Jun.03,2021

let upName = ''
let downName = ''

data.filter((item) => {
  for (let i in item.line) {
    if (item.line[i].type === 'up' && item.line[i].place === upName) {
      return true
    }
  }
}).filter((item) => {
  for (let i in item.line) {
    if (item.line[i].type === 'down' && item.line[i].place === downName) {
      console.log('' + item.name)
      return true
    }
  }
})

is that okay?

Menu