Question user-bcc4abdfa1b3ae5c in lesson «Iterative process and not being lazy», course «Programming fundamentals»


Does anyone know why I'm getting an error with this function? It seems to work fine if I run it in the Chrome JS console.

const smallestDivisor = (num) => {

// BEGIN (write your solution here)

function iter(val, acc) { // console.log(val, acc) if (val % acc === 0) { return acc; } return iter(val, acc + 1); } return iter(num, 2);

// END


0 0

Используйте Хекслет по максимуму!

  • Задавайте вопросы по уроку
  • Проверяйте знания в квизах
  • Проходите практику прямо в браузере
  • Отслеживайте свой прогресс

Sign up or sign in

By sending the form, you agree to Personal Policy and Service Conditions

Suggested learning programs

From zero to a developer. Refunds in case you won't get a job

Frontend Developer icon
Development of front-end components for web applications
20 June 10 months