Skip to content

#015 Word without First Character

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

015 Word without First Character

Create a function that takes a word and returns the new word without including the first character.

Current source and tests | Catalog | Testing and tooling

Run this solution

From the cloned repository root, after installing dependencies:

node "Edabit/015 Word without First Character.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 word and returns the new word without including the first character.
function newWord(str) {
    return str.slice(1);
}
import { assertEquals } from '../testHelper.js';
assertEquals(newWord("pokhara"), "okhara")
assertEquals(newWord("biratnagar"), "iratnagar")
assertEquals(newWord("nepal"), "epal")
assertEquals(newWord("damak"), "amak")
assertEquals(newWord("itahari"), "tahari")
assertEquals(newWord("rasuwa"), "asuwa")
assertEquals(newWord("rolpa"), "olpa")

Clone this wiki locally