Given the following Javascript, would it be better/more idiomatic to inject the MyService object into myMethod so that a fake version of MyService could be injected for testing? Or am I missing something?
var myObject = {
myMethod: function() {
var myService = new MyService();
return myService.doSomething();
}
}