Поскольку кажется, что вы используете jQuery, вы можете сделать следующее:
var countBoxes = function(){
const result = [];
var $rows = $(document).find("tr"); //demo purpose, normally you would pass this as a param
$rows.each(function(i, elem){
result.push({row: i+1, amount: $(elem).find('input[type="checkbox"]:checked').length});
});
console.log(result) //=> {row: 1, amount: 1}
// {row: 2, amount: 1}
// {row: 3, amount: 2}
// {row: 4, amount: 1}
}
Он просто проходит по всем строкам () и проверяет наличие флажков ввода типа, которые отмечены (: флажок).