What is the diference between assigning value to declared variable and assigning value to non-declared variable ? I got a case where it have a difference.
Go to chrome browser console and put this code:
var x=8;
delete x; //it will return false because it is not deleted.
x; //and it return 8;
And then:
y=9;
delete y;// it return true here .because it is deleted. but in previous case that variable not deleted why ?
y; //it will return error:Uncaught ReferenceError: y is not defined.
I don't know why the variable which is declared is not deleted and variable which is not declared is deleted ?
Beyond this, is there any more difference between these two, then please specify.
Thanks!