score:0

Take the input values and directly put them into the dataset. I don't see the need for the totals array.

And set the properties of the dataset array of objects,

  var dataset = [
    {label: 'Female Count', count: 1},
    {label: 'Male Count', count: 1}
];

    function getTotals() {
        dataset[0].count = document.getElementById('totalFemales').value;
        dataset[1].count = document.getElementById('totalMales').value;
    }

Related Query

More Query from same tag