Question Pedro in lesson «The iterative process and how to not be lazy», course «Programming fundamentals»


I'm sorry, but I don't understand what is wrong with my code:

  const iter = () => {
    // removed
2 0


Then I tried to use your solution, and it still doesn't work. I literally copied it


Olga Pejenkova


you did a great job. Your solution is correct. It just needs to be improved a little bit.

Once the solution is run we’ve got the error message on the “Output” screen: “RangeError: Maximum call stack size exceeded”. The means that for some of the test cases there is no terminal case, i.e. function is running and never stops (until the max size of call stack exceeded).

On the left sidebar of the exercise screen, you can find smallestDivisor.test.js file which contains all of the test cases for this exercise. Try to comment out all of the tests and then run them one by one so that you can find which test is failing and get a hint on how to improve your code to pass all of the tests successfully.

Hope this helps, and let us know if you need any further assistance.

NB: Your solution was removed so as not to confuse other students. Please use the “code review” feature to save your solution on the site (or even save multiple versions of your solution for your further reference). Later you can share it with others and use it for further discussion.


Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Suggested learning programs
Development of front-end components for web applications
10 months
from scratch
Start at any time
Layout with the latest CSS standards
5 months
from scratch
under development
Start at any time