<span class="result">12 раз</span>
<span class="result">5 раз</span>
<span class="result">89 раз</span>
<span class="result">37 раз</span>
var items = document.querySelectorAll('.result')
var collection = ['1 раз','2 раз','3 раз','1 раз','1 раз'];
function foo(collect, callback) {
var res = [];
for(var i=0; i<collect.length; i++) {
var arr = collect[i].split(' ');
res.push(+arr[0]);
}
callback(res);
}
foo(collection, function(res) {
var sum = 0;
res.forEach(function(i) {
sum += i;
});
console.log(sum);
});