title: How to pass variable in a variable in JavaScript?
body: <p>I want to define a variable that contains a variable. In this example the variable that I want to pass is "filldata".</p>
  
  <p>I have tried passing it using $filldata as well as +filldata+.</p>
  
  <pre><code>if (fill == true) {
       $filldata = "fill: true,";
  } else {
       $filldata = "fill: false,";
  };
  
  if (amount == true) {
          var set1 = {
              label: "Earnings",
              id: "earnings",
              data: data1,
              points: {
                  show: true,
              },
              bars: {
                  show: false,
                  barWidth: 12,
                  aling: 'center'
              },
              lines: {
                  show: true,
                  $filldata
              },
              yaxis: 1
          };
      } else {
          var set1 = "";
      }
  </code></pre>