Maximum call stack exceeded error ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Maximum call stack exceeded error ?

In my javascript code it is showing maximum call stack exceeded error and how to fix the error. Please help me

31st Jul 2021, 2:00 PM
Arun Jamson
Arun Jamson - avatar
4 Answers
+ 5
You can fix it by stopping the function at some point by returning a value and not just running it infinitely . If you want further help , then attach your code link in description. Or copy paste it.
31st Jul 2021, 2:03 PM
Abhay
Abhay - avatar
+ 2
It seems likely you have a function that calls itself recursively. Recursive programming requires a conditional statement that does a final return without calling itself again. Either the end condition is never getting triggered or that logic is missing from your function.
31st Jul 2021, 2:47 PM
Brian
Brian - avatar
0
Can you give me an example
31st Jul 2021, 4:23 PM
Arun Jamson
Arun Jamson - avatar
0
Here is a JavaScript recursion example https://code.sololearn.com/W1oLy5E1Q89Z/?ref=app
1st Aug 2021, 3:11 AM
Brian
Brian - avatar