I was unsure what the question was here, but did you want to set the value of subTotals to a variable such as sum_bara?
SubTotals is defined as an array, as shown in the following process.
var subTotals = new Array();
it is possible to get the value by specifying a character, as shown below.
However, it also looks like you want to change 'undefined' to a numeric value,
so could you please confirm the details of what you want to do?
Also, since it seems that you are manipulating the values in the table,
I would like to know what values are set in each field that affects the process,
such as the "typeab" field and the "price1" field, as well as sample data and the expected results.