Defining classes in JavaScript
<p>I have been reading up on object-oriented JavaScript. This is a link that I have been reading, <em><a href="https://developer.mozilla.org/en/Introduction_to_Object-Oriented_JavaScript" rel="nofollow">Introduction to Object-Oriented JavaScript</a></em>. However, I have also been reading the book <em><a href="http://rads.stackoverflow.com/amzn/click/143021578X" rel="nofollow">Practical CakePHP Projects</a></em>. I am trying to figure out why do they use class to define the class? From what I have read, you are supposed to define classes using the <code>function</code> keyword. The code below is an example from the book. Were the authors just wrong or is there something that I am missing?</p>

<pre><code>var TravelMapprManager = Class.create({

    //Constructor
    initialize: function(map_container) {
        this.map_container = map_container;

        //Start the map.
        Event.observe(window, 'load', this.displayMap.bind(this));

        //Observe the map buttons.
        Event.observe(document, 'dom:loaded', this.initObservers.bind(this));
    },
</code></pre>
