js数组合并

// ES6 的写法
  const filterA = [], filterB = [], filterC = [],filterD = [], filterE = [] filterdata = [];
    for (var Info in queryInfo) {
      if (queryInfo[Info].strength == strength) {
        filterA.push(queryInfo[Info].medicineName)
      }
      if (queryInfo[Info].full == full) {
        filterB.push(queryInfo[Info].medicineName)
      }
      if (queryInfo[Info].thickness == thickness) {
        filterC.push(queryInfo[Info].medicineName)
      }
     
    }
    for (var i in filterA) {
      for (var j in filterB) {
        for (var k in filterC) {
          if (filterA[i] == filterB[j] && filterA[i] == filterC[k] && filterA[j] == filterA[k]) {
            filterdata.push(filterA[i]);
            // console.log(filterA)
          }
        }
      }
    }
    filterdata.push(...filterD);
    filterdata.push(...filterE);

    console.log(filterA)
    console.log(filterB)
    console.log(filterC)
    console.log(filterdata)

 js数组合并_第1张图片

 

你可能感兴趣的:(vue)