You are viewing a single comment's thread. Return to all comments →
for JS
interface AdvancedArithmetic{ divisorSum(n: number): number; } class Calculator implements AdvancedArithmetic { divisorSum(n: number): number { let sum = 0 for (let i = 1; i < (n + 1) / 2; i++) { if (n % i === 0) { sum += i } } return sum + n } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 19: Interfaces
You are viewing a single comment's thread. Return to all comments →
for JS