SOURCE

// let data = [
//     { id: 1, name: '张三', age: '25' },
//     { id: 1, name: '张三', age: '25' },
//     { id: 1, name: '张三', age: '25' },
//     { id: 1, name: '张三', age: '25' }
// ]

// function removal(data){
//     let map=new Map()
//     for(let item of data){
//         map.set(item.id,item)
//     }
//     console.log(map)
// }

// removal(data)
// 122157351551153786

  //判断是箱码还是瓶码
 function checkCode(boxCode) {
    let length = boxCode.length
    // console.log(length == 18)
    if (length == 18) {
      let substring = boxCode.substring(1, 2)
    //   console.log(substring)
      if (substring == '7') {
        return 0
      }
      if (substring == '5') {
        return 1
      }
      //瓶码也返盒码
      if (substring == '3') {
        return 1
      }
      return 1
    } else {
      let substring = boxCode.substring(0, 1)
      if (substring == '8' || substring == '9') {
        return 0
      } else {
        //其他都返盒码
        return 1
      }
    }
  }

  console.log(checkCode('152277321462812517'))
console 命令行工具 X clear

                    
>
console