Creating a javascript object with initial values, how?
<pre><code>    objCar = function(values){
     this = values;
     race = function(){
      alert('car model:'+this.model+' car brand: '+this.brand+' was joined the race');
     };
    };

    car = new objCar({'brand':'ford','model':'fiesta'});
    car.race;
</code></pre>

<p>I want to objCar be started with a json values for example and that these values can be passed in constructor and after that i can call the race function that is created inside the constructor of objCar, is that possible? when i try to do this i receive it: </p>

<blockquote>
  <p>invalid assignment left-hand side
  error source line: [Parar neste erro]
  this = values;</p>
</blockquote>

<p>tnx.</p>
