October 15th, 2024
What's missing in this code?
// Check if num is a product of two consecutive numbers
isHeteromecic(0); // true (0 * 1)
isHeteromecic(2); // true (1 * 2)
isHeteromecic(7); // false (2 * 3 = 6)
isHeteromecic(110); // true (10 * 11)
isHeteromecic(136); // false (11 * 12 = 132)
isHeteromecic(156); // true (12 * 13)
function isHeteromecic(num) {
for (let n =
;
<= num; n++) {
if (n *
=== num) {
return true;
}
}
return false;
}
Type or select from these options