It looks like you're working with Strings (and thus a + b
is the concatenation operator) when you want to be working with Number (so x + y
would be addition)
Perform your favorite way to cast String to Number, e.g. a unary +x
var kacbegen = +$("#math" + begen).text();