<div class="unit">10</div>
<div class="unit">15</div>
<div class="unit">30</div>
<div class="totelunit">55</div>
const setTotalUnit = () => {
const total = document.querySelector(".totelunit");
const units = document.querySelectorAll(".unit");
let sum = 0;
units.forEach(item => {
sum += +item.innerHTML;
})
total.innerHTML = sum;
}