You need to define your private functions as methods of a private object:
function UserInterface() {
this.getViewHtml = function(view) {
return methods['get' + view + 'ViewHtml']();
};
var methods = {
getFirstViewHtml : function() { return someHtml; },
getSecondViewHtml : function() { return someHtml; },
}
}
Alternatively you could use a switch:
this.getViewHtml = function(view) {
switch(view) {
case 'first': return getFirstViewHtml();
case 'second': return getSecondViewHtml();
default : throw new Error('Something is terribly wrong');
}
};