Having this .js file:
var MyClass = function() {
};
MyClass.prototype = function myMethod(name) {
// my statements here...
// name is undefined here, but who calls this function and why?
return {
myMethod: myMethod
};
}();
and a page which loads it:
<head>
...
<script src="myfile.js"></script>
</head>
Question
Why is this function called? As far as with my javascript limited knowledge I understand I am initializing a MyClass variable (which is containing a function) and adding a new function to the prototype. Obviosly I am missing something.