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:

Solution
Solution

Tests are available in Playground

Have a good evening! 🌆

typescript

Alexey Berezin

Senior Software Engineer, UK Global Talent 🇬🇧

The portrait photo of me

Thank you for reading my blog post! If you have any questions, suggestions, or just want to say hi, feel free to reach out in social networks, or via email. I would love to hear from you!

Comments