This is a solution that demonstrates getting the text from the page using Node.textContent, matching a floating point number (this includes whole integers) with exponent (if exists) surrounded in "{" and "}" but not consuming the trailing "}", using a regex, and then performing a sum of them . During the sum we remove the leading "{" by using String slice.
HTML
<div>Lorem ipsum<span>dolor sit amet, </span>{5} consectetur adipisicing<span>elit {2}, sed do eiusmod</span><span>{9} tempor incididunt ut labore </span>et dolore magna aliqua.</div>
Javascript
var array = document.body.textContent.match(/{[-+]?\d*\.?\d+([eE][-+]?\d+)?(?=\})/g);
var length = array.length;
var i = 0;
var sum = 0;
while (i < length) {
sum += parseFloat(array[i].slice(1));
i += 1;
}
console.log(sum);
On jsfiddle
For interest sake, here is a jsperf of the current (3) answers.