JavaScript
35
Вклад в тег
const collections = []
for (let i = 0; i < data.length; i++) {
if (!collections.includes(data[i].collection)) {
collections.push(data[i].collection);
}
}
const collections = Array.from(new Set(data.map(d => d.collection)));
const collections = Object.keys(data.reduce((res, next) => {
res[next.collection] = null;
return res;
}, {}));
const collections = data.reduce((res, next) => {
if (!res.includes(next.collection)) {
res.push(next.collection);
}
return res;
}, {});
var objFromOptions = Object.assign({}, options.obj);
JSON.parse(JSON.stringify(options.obj))