Skip to content Skip to sidebar Skip to footer

Putting A Variable Into Name Of Function Javascript

I want to do the following: var table = new google.visualization.XXXXX(document.getElementById(divId)); where the X's represent a variable that is set previously. Just so you know

Solution 1:

Use square bracket notation.

var XXXXX = "someString";
var table = new google.visualization[XXXXX](document.getElementById(divId));

Solution 2:


Post a Comment for "Putting A Variable Into Name Of Function Javascript"