Trim in TypeScript

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 in TypeScript

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

Solution

Tests are available in Playground

Have a good evening! ๐ŸŒ†

typescriptmedium

Let's chat and have fun ๐Ÿง‘โ€๐Ÿ’ป๐Ÿ‘ฉโ€๐Ÿ’ป

No more often than once a week I write ๐Ÿ“„ about TypeScript ๐Ÿ’ช, video playback ๐Ÿ“บ and frontend related topics. You can unsubscribe in any time โ†˜๏ธ

ยฉ 2021, Built with Gatsby