StringprototypetrimStart
String.prototype.trimStart is a method in JavaScript that is used to remove whitespace characters from the beginning of a string. It was introduced in ECMAScript 2019 (ES10) as an alternative to the existing String.prototype.trimLeft method, which served the same purpose. The trimStart method does not modify the original string but instead returns a new string with the leading whitespace removed.
The method takes no arguments and returns a new string with all leading whitespace characters removed. Whitespace
Here is an example of how to use the trimStart method:
let originalString = " Hello, World!";
let trimmedString = originalString.trimStart();
console.log(trimmedString); // Output: "Hello, World!"
In this example, the originalString has leading spaces that are removed by the trimStart method, resulting
The trimStart method is particularly useful when you need to clean up user input or process strings