I am trying to call a function with setTimeout() inside another function and I keep getting this error:
hi is not defined
This is the code.
hello("hi");
function hello(a)
{
hi(a);
function hi(b)
{
console.log(b);
c = setTimeout('hi("' + b + '")', 50)
}
}
One "hi"
is being logged, but then it just stops. I believe problem is in this part: c = setTimeout('hi("' + b + '")', 50)
Is there a fix without changing function inside function structure?