On the problem of joint adjustment of data

original data format:

[
 {
    name:,
    code:admin
 },
 {
    name:,
    code:user
 },
 {
    name:,
    code:super
 }
]

some result values can be obtained after filtering

["",""]

but at present, the parameter that is modified and passed to the backend needs to be in the form of code, that is, the result value of "admin,user". How to write loop traversal here

Mar.14,2021

var arr = ['',''];
var arr1 = [];
var originalData = [
 {
    name:'',
    code:'admin'
 },
 {
    name:'',
    code:'user'
 },
 {
    name:'',
    code:'super'
 }
];
for(var i = 0, len = originalData.length; i < len; iPP){
   for(var j = 0, len1 = arr.length; j < len1; jPP){
        if(arr[j] == originalData[i].name){
            arr1.push(originalData[i].code);
        }
   } 
}

is that what you mean?


const data = [
    { name: '', code: 'admin' },
    { name: '', code: 'user' },
    { name: '', code: 'super' }
]
const names = ['', '']
let codes = data.filter(({name})=>names.indexOf(name)!==-1).map(person=>person.code)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e53735-4521f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e53735-4521f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?