I have this self execute function that call itself:
(function a(x){
if(x > 0){
x--;
console.log(x);
}
a(x);
})(5);
//outputs 4 3 2 1 0
This is correct behaviour . But if i pass this function to a variable how i can achieve the same behaviour?
var a = (function (x){
if(x > 0){
x--;
console.log(x);
}
//a(x); outputs error
})(5);