score:8 is an array of datasets, not a single dataset. datasets does not have its own data and label attributes. Rather, each individual dataset in the array has its own data and label attributes. You therefore cannot do or dataset.label.

If you want to update the data or label variable of a specific dataset, you need to select that object from the array. To select the first dataset, simply use datasets[0]:[0].data = [amazon, google, facebook, twitter];[0].label = label;

If you want to update all datasets, use a forEach loop to iterate through the array: => { = [amazon, google, facebook, twitter];
    dataset.label = label;

Two more points:

One other possible problem is that the names variable is not initialized anywhere, though it could be that you just didn't include that part of the code in your question.

Also, why do you have the following three lines of code, if you just reassign all the values in the next three lines of code? = []; = []; = null;

Related Query

More Query from same tag