其他分享
首页 > 其他分享> > 数组相关操作

数组相关操作

作者:互联网

1. 将数据对象重组成需要的数组

  

 const obj = {
        fileId: '2022091247189020160833,2022091247189166178204',
        fileName: 'logo-axa.png,1.zhimg.jpg',
        time: '2022-09-08 13:20:00',
        postalCode: '12345678',
        policyHolderAddress: '上海市上海市浦东新区',
        owner: 'admin',
        success: '1',
      }
      const a = obj.fileId.split(',').map((val, item) => {
        return Object.assign({}, { fileId: val, fileName: obj.fileName.split(',')[item] })
      })
      console.log(a)

 

标签:obj,val,const,fileName,split,数组,相关,操作,fileId
来源: https://www.cnblogs.com/kymming/p/16670228.html