prototype in JavaScript

function pop()
    {
      if(this.length != 0)
      {
        var lastElement = this[this.length-1];  
        this.length = this.length-1;            
        return(lastElement);
      }
    }
    //Make the pop() function available to all Array objects
    //This will override the pop() method provided by the Array object in Netscape
    Array.prototype.pop = pop;

    var flavorArray = new Array("A","B","C");
    document.write(flavorArray.join(', '),"<br>");

    var removedElement = flavorArray.pop();
    document.write(removedElement," was removed from the flavor array.<br>");

    document.write("new array: ");
    document.write(flavorArray.join(', '),"<br>");