Trim string literal type in TypeScript

Example of Trim use
Example of Trim use

Today we discuss Trim

String.prototype.trim does the same in JavaScript what we are about to do in TypeScript.

Let's try 👩‍💻

Apply filtering to both sides

Last challenge was Trim Left

We removed whitespaces only for the left part of the string, let's remove them from the right side:


Tests are available in Playground

Have a good evening! 🌆

Alexey Berezin profile image

Written by Alexey Berezin who loves London 🏴󠁧󠁢󠁥󠁮󠁧󠁿, players ⏯ and TypeScript 🦺 Follow me on Twitter