In a javascript I have the following variables:
var num_a = 7;
var num_b = 5;
and I want to replace the numbers with variables
var datos = [{ name: "Pedacito", data: [["Muestra A", 7], ["Muestra B", 5]]}]
I've tried all of these and none work for me:
OPTION 1
var datos = [{ name: "Pedacito", data: [["Muestra A", $(num_a)], ["Muestra B",$(num_b)]]}]
OPTION 2
var datos = [{ name: "Pedacito", data: [["Muestra A", $(#num_a)], ["Muestra B",$(#num_a)]]}]
OPTION 3
var datos = [{ name: "Pedacito", data: [["Muestra A", $(num_a)], ["Muestra B",$(num_a)]]}]
OPTION 4
var datos = [{ name: "Pedacito", data: [["Muestra A", ${num_a}], ["Muestra B",${num_a}]]}]
Any idea how I can do?
You just have to add the variable, you are missing one , in
"Muestra A",
, it threw an error.