Вы попали на английскую версию сайта. Большая часть курсов доступна на русском языке

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

user-bcc4abdfa1b3ae5c

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

Do you have a question or would you like to participate in a discussion?

Sign up or sign in

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

Related topics

Max Giselson 22 October 2018 →

Im stuck on this part and not entirely sure wether close or not:( I understand the theory but as goes for t...

Тимур А 13 January 2017 →

my code is: var i = 2; while (num%i > 0) { i++; } return i; and OUTPUT says Run failed! Check an...