Г
Size: a a a
М
v
const items = [
{
id: 1,
opened: false,
},
{
id: 2,
opened: false,
},
{
id: 3,
opened: false,
},
{
id: 1,
opened: true,
},
{
id: 1,
opened: false,
},
]
console.log(JSON.stringify(items.filter((item, index, arr) => arr.indexOf(item) === index) && item.opened));
ЕГ
Г
ЕГ
М
v
const dictionary = {?
entries: [
{active: true},
{active: true},
{active: false},
],
options: [
{value: 0},
{value: 1},
{value: 2},
]
};
filteredOptions => [{value: 0}, {value: 1}];
М
const dictionary = {?
entries: [
{active: true},
{active: true},
{active: false},
],
options: [
{value: 0},
{value: 1},
{value: 2},
]
};
filteredOptions => [{value: 0}, {value: 1}];
v
const filteredOptions = dictionary.options
.filter((option, index) => dictionary.entries[index].active);
D
М
const filteredOptions = dictionary.options
.filter((option, index) => dictionary.entries[index].active);
v
AB
L
DB
S