correctGuess() and incorrectGuess() functions for a quiz
i did not test or execute this code

just put it in an object?

var Guess = {

    score : 0,
    questions_count : 0,

    text : null,

    correct : function () {
        this.score+= 1;
        this.questions_count += 1;
        this.text = 'Correct!';
    },

    incorrect : function () {
        this.score-=1;
        this.questions_count += 1;
        this.text = 'Wrong!';
    },

    update : function () {
        var updatePage = ['&lt;div id="answerDiv"&gt;' +
        '&lt;h1&gt;' + text + '&lt;h1&gt;' +
        '&lt;h2&gt;Total Score: ' + this.score + '&lt;/h2&gt;&lt;/div&gt;'
        ];

        mainContent[html](updatePage);

        $('#answerDiv')[fadeIn]("slow");
        $('#answerDiv').append('&lt;button id="nextButton"&gt;Next Question&lt;/button&gt;');

        $('#nextButton').on('click', function() {
            if (this.questions_count == allQuestions.length &amp;&amp; totalScore &lt;= 4) {
                results();
            } else {
                question(this.questions_count);
            }

        });
    }
};


chaining

key to chaining calls is to return the right thing. Simple example:

function test() {
    var x = {
        correct : function () {
            console.log('correct');
        },
        incorrect : function() {
            console.log('incorrect');
        }
    };

return x;
}

test().correct();