This is the function I am currently working on:
function getSmallestDivisor(xVal) { if (xVal % 2 === 0) { return 2; } else if (xVal % 3
if (xSqrt % 1 === 0) { return getSmallestDivisor(xSqrt); // missing return here } else { return xVal; }
Demo: Fiddle