well as of many i am also confuse with this in JS as i know how to use this in DOM but failed to understand in OOP as
a = "uff";
function Class1() {
a = "";
}
function Class2() {
this.a = "";
}
well = new Class1();
oh = new Class2();
well.a = "bye";
oh.a = "ok";
console.log(well.a); // output: bye
console.log(oh.a); // output: ok
console.log(a); // output: ""
in above example using this or not is not effecting code so why do i use it and why last value of a is getting printing empty?? i will very thankful to all of you.