I would like to check if a class type is even instantiable before attempting to instantiate it via the new keyword in javascript.
For example
var geocoder = new GClientGeocoder();
will fail if the GClientGeocoder class is not available in the namespace.
What’s the javascript idiomatic way to do this?
You should be able to do:
if (!!GClientEncoder)
or:
if (typeof(GClientEncoder) !== “undefined”)