1

I have no idea how to even look for an answer to this question. I've tried loads of variations of search to no avail.

I bet it's the most simple thing too.

I need to use an array to store parameters for a new object.

var params = [0, 0, false];
var obj = new google.maps.LatLng(params);

Obviously the above will fail as it doesn't accept an array, but separate parameters. This is just an example.

I'd rather not have to step through the array, like params[0].

The reason is, I am wanting to set up an object factory, that may have variable parameter lists, so I would set some options, with a type, and array of params, and then when I call a create function it does

var factory = new Factory({
  type: 'LatLng',
  params: [0, 0, false]
});

var latLng = factory.create();
designermonkey
  • 1,078
  • 2
  • 16
  • 28

0 Answers0