I tried to search it on internet but didn't got any answer. Why access of two variables before declaration have two different outputs:
function test() {
    console.log(a); // prints 'undefined'.
    console.log(b); // prints 'b is not defined'.
    var a = 5;
    this.b = 10;
}
 
     
     
    