Skip to content

#186 Tables

Adam Kubiś edited this page Oct 28, 2026 · 1 revision

186 Tables

Create a function that takes a number n and returns the first 10 multiples of n with 1 added to it, separated by commas.

Current source and tests | Catalog | Testing and tooling

Run this solution

From the cloned repository root, after installing dependencies:

node "Edabit/186 Tables.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.

Current implementation and tests

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.

//Create a function that takes a number n and returns the first 10 multiples of n with 1 added to it, separated by commas.
function nTablesPlusOne(n) {
    return Array.from({ length: 10 }, (_, i) => (i + 1) * n + 1).join(',')
}
import { assertEquals } from '../testHelper.js';
assertEquals(nTablesPlusOne(1), "2,3,4,5,6,7,8,9,10,11")
assertEquals(nTablesPlusOne(7), "8,15,22,29,36,43,50,57,64,71")
assertEquals(nTablesPlusOne(134), "135,269,403,537,671,805,939,1073,1207,1341")

Clone this wiki locally