score:1

Accepted answer

you are assigning a function to hidden not the result of this function. but if condition = true returns true. why not just do hidden: condition this will return the same result and doesn't require a function call. other option would be this construction.

for(let i =0; i < chartdata.length; i++){
 const hidden = condition;
 parseddata.push({
   label: custnamearray[i],
   data: [chartdata[i]],
   backgroundcolor: "rgba(0, 142, 204, 1)",
   hoverradius: 9,
   hidden  
})

Related Query

More Query from same tag