I have a want to create a object Metrics within which I need to initialize various other objects such as StatsD.
I know how to create Metrics object in javascript.
function Metrics(params) {
// initialize params
}
Metrics.prototype.functionName = function() {
}
However I am confused is how to embed an object inside another object and access its methods ?
In java it would be easy:
class Metrics {
StatsD statsD;
}
new Metrics().statsD.increment("foobar");
How would I do the same in javascript ?