I am trying to generate csv file from Javascript data input. Each row needs to be from the next cycle of input.

It is not outputting any CSV.

The add and update buttons must both be used per each cycle of input in order to generate a new csv row. For some reason, the ".innnerhtml" does not work when commented in either.

Here's my code:

```
<!DOCTYPE html>
<html>
<body>

<h2>My First Web Page</h2>
<p>My First Paragraph.</p>

<p id="demo"></p>
<a href='#' onclick='downloadCSV({ filename: "data-" + ID + ".csv" });'><button title = "download data">⬇️</button></a>
<button onclick="update()">update</button>
<button onclick="add()">add</button>
<script>
function add() {
var ID = prompt("Please enter your email address (One per user)");
var HR = prompt("Please enter your HeartRate");
var TIME = prompt("please enter the time");
var PREDICTION = prompt("Please enter your HR prediction")
var biodata = [
        {
            ID: ID,
            HR: "65",
            TIME: "8",
            PREDICTION: "68",
            }
    ];
  }

function update() {
var row = {};
row[ID] = biodata.ID;
row[HR] = biodata.HR;
row[TIME] = biodata.TIME;
row[PREDICTION] = biodata.PREDICTION;
biodata.push(row);
//document.getElementById("demo").innerHTML = biodata;
}

function convertArrayOfObjectsToCSV(args) {
    var result, ctr, keys, columnDelimiter, lineDelimiter, data;

    data = args.data || null;
    if (data == null || !data.length) {
        return null;
    }

    columnDelimiter = args.columnDelimiter || ',';
    lineDelimiter = args.lineDelimiter || '\n';

    keys = Object.keys(data[0]);

    result = '';
    result += keys.join(columnDelimiter);
    result += lineDelimiter;

    data.forEach(function(item) {
        ctr = 0;
        keys.forEach(function(key) {
            if (ctr > 0) result += columnDelimiter;

            result += item[key];
            ctr++;
        });
        result += lineDelimiter;
    });

    return result;
}

function downloadCSV(args) {
    var data, filename, link;

    var csv = convertArrayOfObjectsToCSV({
        data: biodata
    });
    if (csv == null) return;

    filename = args.filename || "data-" + ID + ".csv"; //changed to double qoutes.

    if (!csv.match(/^data:text\/csv/i)) {
        csv = 'data:text/csv;charset=utf-8,' + csv;
    }
    data = encodeURI(csv);

    link = document.createElement('a');
    link.setAttribute('href', data);
    link.setAttribute('download', filename);
    link.click();
}
</script>

</body>
</html>

```