Can variables be written in legend.selected in echarts? Why are the variables I wrote treated as strings?

can variables be written in legend.selected in echarts? Why are the variables I wrote treated as strings?

            console.log(aa);
             optionFH.legend.selected={
                      aa:true,
                      "xx":true,
                      "xx":true,
                         "xxx":false,
                         "xxx":false,
                  }
                  

the print result is as follows.
clipboard.png

Why is my aa treated as a string? How can I get the browser to resolve to variables?

Mar.25,2021

The variables of the

object are saved in the format of a string, here you can

optionFH.legend.selected[aa] = true

however, it is important to note that the variables of the object mentioned just now are saved in the format of a string . If your aa is an object, then

var a = {} , b = {c:1}
a[b] = true; //a{[object Object]:true}

automatically calls toString to convert the object to a string

Menu