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?

Neuron
  • 5,141
  • 5
  • 38
  • 59
Gunacelan M
  • 179
  • 2
  • 10
  • [`"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