Happy to do so. Given the following code (JavaScript), the interviewer claimed that "appVar2" needed to be returned from the function expression (using a "return" statement) to make "MyConstructor" available outside the scope of the closure created by the function expression. He claimed that by injecting appVar1 into the function expression it was being copied, implying that appVar2 referred to a separate object, hence the need to return.
This is a fundamental misunderstanding of the way JavaScript uses "pass reference by value" (described more commonly as "pass by reference") when dealing with objects.
Code:
var appVar1 = {};
(function(appVar2){
appVar2.MyConstructor = function() {
//...
};
})(appVar1);
Mock me all you want!