I am trying to get the last value from a for loop. I have tried a number of things including pop() and lastchild but all I get is the “This is not a function” error. Can someone offer any help with this?
var totalAppointments = Array.from(recordXmlNode.children[1].innerHTML);
var numberAppointments = totalAppointments.map(Number);
for (let i = 0; i < numberAppointments.length; i++) {
sum += numberAppointments[i];
}
console.log(sum);
Thanks