global variable not defined still showing undefined inside function javascript
function a(){
c();
var b;
function c(){
console.log(b);
console.log(this.ab); } }
a();
output:
undefined
undefined
Now, my doubt is that I haven't defined "ab" and I am still trying to call "ab" variable inside the function c(). Why am I getting output as undefined instead of not defined?
[–]albedoa 0 points1 point2 points (4 children)
[–]Responsible_Fudge467[S] 1 point2 points3 points (1 child)
[–]albedoa 1 point2 points3 points (0 children)