DE
Size: a a a
DE
VI
const obj = {
'5': '5',
4: 'asdf',
1: 'q2',
2: 'a',
extra: '12'
}
const res = Object.entries(obj).sort(([a], [b])=>{
let orderLeft = order.indexOf(a)
let orderRight = order.indexOf(b)
if(!orderLeft || orderRight<0) {
return -1;
}
return orderLeft < orderRight?-1:1
}).map((el)=> el[1])
console.log(res)
S
const obj = {
'5': '5',
4: 'asdf',
1: 'q2',
2: 'a',
extra: '12'
}
const res = Object.entries(obj).sort(([a], [b])=>{
let orderLeft = order.indexOf(a)
let orderRight = order.indexOf(b)
if(!orderLeft || orderRight<0) {
return -1;
}
return orderLeft < orderRight?-1:1
}).map((el)=> el[1])
console.log(res)
DE
const obj = {
'5': '5',
4: 'asdf',
1: 'q2',
2: 'a',
extra: '12'
}
const res = Object.entries(obj).sort(([a], [b])=>{
let orderLeft = order.indexOf(a)
let orderRight = order.indexOf(b)
if(!orderLeft || orderRight<0) {
return -1;
}
return orderLeft < orderRight?-1:1
}).map((el)=> el[1])
console.log(res)
JD
DE
JD
DE
DE
DE
DE
AK
DE
DE