Skip to content

Instantly share code, notes, and snippets.

View VForVogue's full-sized avatar
💭
Focusing on knowledge

Vadim_Bobryakov VForVogue

💭
Focusing on knowledge
  • Government
  • Russia
  • 13:22 (UTC -12:00)
View GitHub Profile
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]);
}
// BEGIN (write your solution here)
const smallestDivisor = num => {
let divisor = 2;
if(num < 1) {
return NaN;
}
if(num === 1) {
return num;