Can't create functions in javascript object
<p>I have two objects</p>

<pre><code>function Response(dbResponseId, responseText){
    this.response = {
        "dbResponseId" : dbResponseId,
        "responseText" : responseText,
        "isDeleted" : false,

    };  

    this.setResponseText = function(responseText){
        this.response.responseText = responseText;
        return this.response;

    };

    this.getId = function(){
        return this.response.frontEndId;
    };
    this.deleted = function(){
        this.response.isDeleted = true;
    };
    return this.response; 
}

function OptionGroup(responses, dbOptionGroupId,isDeleted,id){
    this.optionGroup = {"dbOptionGroupId" : dbOptionGroupId, "responses" : responses, "isDeleted" : isDeleted,"frontEndId" : id};

    this.setResponses = function(responses){
        this.optionGroup.responses = responses;
        return this.optionGroup;
    };
    this.addResponse = function(response){
        this.optionGroup.responses.push(response);
        return this.optionGroup;
    };
    this.getId = function(){
        return this.optionGroup.frontEndId;
    };
    this.setId = function(id){
        this.optionGroup.frontEndId = id;
        return this.optionGroup;
    };
    this.deleted = function(){
        this.optionGroup.isDeleted = true;
        return this.optionGroup;
    };
    this.getResponsesById = function(id){
        for(var i = 0; i &lt; this.optionGroup.responses.length;i++){
            if(id == this.optionGroup.responses[i].getId()){
                return this.optionGroup.responses[i];
            }
        }
        return null;
    };

    return this.optionGroup;
}
</code></pre>

<p>However, when I try and call any of the functions that I've created, console tells me that said object does not have such a function. When I print out a Response or OptionGroup object in console, I can see the fields in the objects, but I cannot see any of the functions. </p>

<p>What is going on? </p>
