-
Code export function takeFirstWord (text: string) { const split: string[] = text.split('').filter(char => char === char.toUpperCase()); const join: string = split.join(''); return join.replace(/\s/g, "") } takeFirstWord("I Love Typescript")
Preloaded Code export function takeFirstWord () { // You Can Only Code Here }
Test Cases // See https://www.chaijs.com for how to use Chai. import { assert } from "chai"; import { takeFirstWord } from "./solution"; // TODO Add your tests here describe("Testing_1", function() { it("Checking Code", function() { // assert.strictEqual(1 + 1, 2); assert.strictEqual(takeFirstWord("I Love Typescript"), "ILT") }); });
Output:
-
Code - export function takeFirstWord (text: string) {
}- const split: string[] = text.split('').filter(char => char === char.toUpperCase());
- const join: string = split.join('');
- return join.replace(/\s/g, "")
- }
- takeFirstWord("I Love Typescript")
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}