Hovik,
window.addEventListener("load", function() {
let sample = [
['design', 'galery', 'slider', 'contacts'],
['design', 'galery', 'slider', 'contacts', 'logo', 'animation'],
['design', 'galery', 'slider', 'contacts', 'logo', 'animation', 'chat', 'seo'],
['design', 'contacts', 'slider', 'galery'],
['design', 'galery', 'logo', 'animation', 'chat', 'seo']
]
let carts = [...document.querySelectorAll('.pasive')];
carts.forEach((form) => {
let sumOut = form.querySelector('.score');
let img = form.querySelector('.cart_star')
form.addEventListener("change", () => {
let checks = [...form.querySelectorAll('input[type="checkbox"]:checked')];
let sum = 0;
let checksName = checks.map(item => (sum += +item.dataset.price, item.name));
sumOut.innerHTML = 'first ' + sum + ' last';
img.src = 'img/stars/stars1.png';
sample.forEach((pattern, i) => {
pattern.every(title => checksName.includes(title)) && (img.src = 'img/stars/stars' + (++i) + '.png')
})
})
})
});