FrontendAtlas
Study
▾
Dashboard
Pricing
Get full access
</> Code
Test cases
Language
JavaScript
TypeScript
export default function capitalizeWords(sentence) { // TODO: Capitalize first letter of each word throw new Error('Not implemented'); }
import capitalizeWords from './capitalizeWords'; describe('capitalizeWords', () => { test('capitalizes each word in a simple sentence', () => { expect(capitalizeWords('hello world')).toBe('Hello World'); }); test('handles mixed casing', () => { expect(capitalizeWords('jaVaScript IS fUn')).toBe('Javascript Is Fun'); }); test('preserves multiple spaces', () => { expect(capitalizeWords(' welcome to earth ')).toBe(' Welcome To Earth '); }); test('returns empty string for empty input', () => { expect(capitalizeWords('')).toBe(''); }); });
▶ Run tests
Results
Console
Run tests to see results.