Javascript create object in function style
<pre><code>#1 (object) 
function Person(f){
      this.firstname = f;

      alert(this.firstname);
    }
    var me = new Person('benny');


#2 (function) 
    function Person(f){
       alert(f);
    }
    Person('benny');
</code></pre>

<p>Im new in js oop, I have knowledge of oop in PHP</p>

<p>My question is what's different between 1st one and 2nd one?</p>

<p>in php, if I create an obj, i will start with <code>class{}</code></p>

<p>in JS, it seems like you can also create an obj <code>var obj = {}</code> OR like create it like a function?</p>

<p>can someone enplane how it works?</p>