This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { length } from './strings'; // eslint-disable-line | |
// BEGIN (write your solution here) | |
const sum = (str) => { | |
let result = 0; | |
for(let i = 0; i < length(str); i++) { | |
result += Number(str[i]); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BEGIN (write your solution here) | |
const smallestDivisor = num => { | |
let divisor = 2; | |
if(num < 1) { | |
return NaN; | |
} | |
if(num === 1) { | |
return num; |