Why does my push() method keep inserting an element of 'undefined' into my array as the first element every time?

```
var elements;
//Create a namespace.
var dataStructures = {
//Create a class called myStack which is a property of the dataStructures (object).
myStack: function () {

    var topOfmyStack;

    //Add the push method to the myStack object
    this.push = function (element) {
        //If no value was entered then stay at zero index and insert nothing
        if (typeof (elements) === 'undefined') {
           elements = [];
            topOfmyStack = 0;
        }
        //Get the next empty space in the stack
        topOfmyStack++;
        //Place the new value in that empty space
        elements[topOfmyStack] = element;
    }
}

```