Adding two Variables together?
use
parseInt(age_child) + parseInt(age_gap);
var age_child = parseInt(10);
var age_gap = parseInt(10);
alert(age_child+age_gap); // should now alert 20
To clarify, in this exact example it is not required to do parseInt
. However, I assumed you didn't exactly have 10
in your code either and they're instead variables.