What is the difference between using 'this' keyword and var in a constructor function in JavaScript? : <p>I'm learning object concepts in JavaScript and have this doubt. Here is the link to the Bin <a href="http://jsbin.com/yoyepetewa/edit?js,console" rel="nofollow noreferrer">http://jsbin.com/yoyepetewa/edit?js,console</a></p>

<pre><code>function Obj() {
    //using 'this' and var produces the same result
    //this.x = 1;
    var x = 1;
}
var a = new Obj();
var b = new Obj();
a.x = 2;
b.x = 3;
console.log(`a's x = ${a.x}`);
console.log(`b's x = ${b.x}`);
</code></pre>
