Uncaught SyntaxError: Unexpected token var in queue
<p>I was implementing queue in JS, but the console keeps siplaying Uncaught SyntaxError: Unexpected token var. I used some online debugger and it points error in line 21. This is the code:</p>

<pre><code>var queue = function (){

var elements = [];
var cur_element = 0;
var del_elem = 0;
return {
    size: function() {
        return cur_element-del_elem;
    },
    empty: function() {
        return cur_element == 0;
    },
    front: function() {
        if(!this.empty()){
            return elements[0];
        }
        return false;
    },
    back: function() {
        if(!this.empty()){
            return elements[cur_element];
        }
        return false;
    },
    push: function(var elem){
        cur_element++;
        elements[cur_element]=elem;
    },
    pop: function() {
        var outcome = elements[del_elem];
        delete elements[del_elem];
        del_elem++;
        return outcome;
    }
    };
};
</code></pre>