Repository navigation
#031 Buggy Code6
Adam Kubiś edited this page Oct 28, 2026
·
1 revision
Mubashir wants to remove numbers from a given string!
Help him by fixing the code in the code tab to pass this challenge.
Current source and tests | Catalog | Testing and tooling
From the cloned repository root, after installing dependencies:
node "Edabit/031 Buggy Code6.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.
//Mubashir wants to remove numbers from a given string!
//Help him by fixing the code in the code tab to pass this challenge.
function removeNumbers(str) {
return str.split('').filter(c => Number.isNaN(Number.parseInt(c))).join('');
}
import * as Test from '../testHelper.js';
Test.assertEquals(removeNumbers("mubashir1"), "mubashir")
Test.assertEquals(removeNumbers("12ma23tt"), "matt")
Test.assertEquals(removeNumbers("e1d2a3b4i5t6"), "edabit")
Test.assertEquals(removeNumbers("pakistan007"), "pakistan")
Test.assertEquals(removeNumbers("ai4653rf53or4235ce"), "airforce")