Sunday, August 12, 2012

Javascript Infinity loop


I don't want to forget this :

I used for loop in my recursive calls using i variable



function recursive(param)
{
//Some stuff
        for (i=0;i            recursive(otherparam)
}

It was creating  infinity loop. The problem that I realized is i is behaving like and global variable , thus creating an infinity loop.

Fix by :

for (var i=0;i</*A Value*/;i++)

No comments:

AI

Despite the benefits of AI we are starving for humanity.