Javascript : difference two ways declare variable in a function
<p>I want to create an object. And, in almost code I have read, they often use this style:</p>

<pre><code>function student(_id, _name, _year){
   this.id = _id;
   this.name = _name;
   this.year = _year;
}
</code></pre>

<p>But, I don't know what the difference with below code :</p>

<pre><code>function student (_id, _name, _year){
   var id = _id;
   var name = _name;
   var year = _year;
}
</code></pre>

<p>I have tested for example, <code>alert</code> properties to screen, and see no difference.</p>

<p>Thanks :)</p>
