Always use parseInt
with a radix (base) as the second parameter, or you will get unexpected results:
var number = parseInt($(this).find('.number').text(), 10);
A popular variation however is to use +
as a unitary operator. This will always convert with base 10 and never throw an error, just return zero NaN
which can be tested with the function isNaN()
if it's an invalid number:
var number = +($(this).find('.number').text());