Repository navigation
#272 Less Than 100 Array Remix
Adam Kubiś edited this page Oct 28, 2026
·
1 revision
Given an array of numbers, return true if the sum of the array is less than 100; otherwise return false.
Current source and tests | Catalog | Testing and tooling
From the cloned repository root, after installing dependencies:
node "Edabit/272 Less Than 100 Array Remix.js"Assertions are kept alongside the implementation and throw on failure. A successful run exits with code 0. Run every exercise with npm test or both lint and tests with npm run check.
This is the complete executable file, including its imports and inline test cases. Run it from the repository, not as an isolated file copied out of the wiki. Line endings and trailing whitespace are normalized; executable tokens are unchanged.
//Given an array of numbers, return true if the sum of the array is less than 100; otherwise return false.
function arrayLessThan100(arr) {
return arr.reduce((acc, num) => acc + num, 0) < 100;
}
import { assertEquals } from '../testHelper.js';
assertEquals(arrayLessThan100([5, 57]), true)
assertEquals(arrayLessThan100([77, 30]), false)
assertEquals(arrayLessThan100([0, 59, 15]), true)
assertEquals(arrayLessThan100([0]), true)
assertEquals(arrayLessThan100([35, 59, 15]), false)
assertEquals(arrayLessThan100([25, 50, 25]), false)