There is a function:
function some_f() { this.first = function () { //code } this.second = function () { //code } } It is necessary that at the first start only the method first returned, and at any subsequent only second . For example:
some_f().second()//ошибка //именно в такой последовательности: some_f().first();//верно some_f().first();//ошибка some_f().second();//верно