const uniqueWithSum = (arr, idKey, sumKey) =>
Object.values(arr.reduce((acc, n) => {
const id = n[idKey];
acc[id] = acc[id] || Object.assign(new n.constructor, n, { [sumKey]: 0 });
acc[id][sumKey] += n[sumKey];
return acc;
}, {}));
// ваш случай
const result = uniqueWithSum(arr, 'id', 'duration');
// элементам не обязательно быть объектами, это могут быть и массивы
uniqueWithSum([
[ 'A', 1 ],
[ 'B', 5 ],
[ 'A', 2 ],
[ 'A', 3 ],
], 0, 1) // [ [ 'A', 6 ], [ 'B', 5 ] ]
<div class="box">
<svg><line x1="0" y1="100%" x2="100%" y2="0" stroke-width="1" stroke="#fff"></line></svg>
</div>
.box {
width: 100%;
height: 500px;
position: relative;
}
svg {
width: 100%;
position: absolute;
height: 100%;
left: 0;
}
.block {
border: 1px solid transparent;
}
.block:hover {
border-color: red;
}
ul.topnav.responsive {position: relative;}
ul.topnav.responsive {
position: absolute;
width:100%;
top: 0px;
}
<div class="col-md-6 col-lg-3 ">
<div class="filter_radio">
<label for="terrasa" class="filter_item__head_radio margin8"><input onclick="terras()" name="terrasa" type="radio" id="terrasa">Есть терраса</label>
<label for="terrasa2" class="filter_item__head_radio mg0"><input onclick="mansard()" name="terrasa" type="radio" id="terrasa2">Есть мансарда</label>
</div>
</div>
<div class="col-md-6 col-lg-3 ">
<div class="filter_radio">
<input onclick="terras()" name="terrasa" type="radio" id="terrasa">
<label for="terrasa" class="filter_item__head_radio margin8">Есть терраса</label>
<input onclick="mansard()" name="terrasa" type="radio" id="terrasa2">
<label for="terrasa2" class="filter_item__head_radio mg0">Есть мансарда</label>
</div>
</div>