1
function Myfunc()
{
    this.a = 10;
    a = 20;
    alert(this.a);
    alert(a);
}


Myfunc();

O/P: 20,20

What is the differnce bw this.a = 10; and a = 20; in the above code?

Gunacelan M
  • 181
  • 1
  • 9
  • [`"use strict"` mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) to get two exceptions. Your code uses bad practices. – Bergi Oct 19 '17 at 13:34

0 Answers0