81 of 264 menu

trimStart method

The trimStart method removes whitespaces at the start of a string and returns a new string without changing the original string.

Syntax

string.trimStart();

Example

Let's remove the extra spaces in the string ' abcde ':

let res = ' abcde '.trimStart(); console.log(res);

As a result of executing the code, we will see that all spaces have been removed at the beginning of the string:

'abcde '

See also

  • the trimEnd method
    that removes whitespaces at the end of a string
  • the trim method
    that removes whitespaces from ends of a string
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline