![]() |
The Its primary purpose is to sanitize and normalize strings, especially user inputs or data fetched from external sources where leading or trailing whitespaces may be present unintentionally. Syntax:const trimmedString = originalString.trimEnd(); Parameters:There are no parameters accepted by the trimEnd method. Return Type:After removing trailing whitespace characters, the procedure returns a new string. Example 1: Implementation to use trimEnd method to eliminate trailing whitespace from a string.
Output: Hello World Example 2: Implementation to use trimEnd method to eliminate trailing whitespace from a string in conjunction with other string operations as well.
Output: TYPESCRIPT IS GREAT! Example 3: Implementation to use trimEnd method to eliminate trailing whitespace from a string and print its length for easy understanding.
Output: 19 Example 4: Using trimEnd with Regular Expressions
Output: 12345 Browser Support: |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |