γƒŸβ˜… 𝘌𝘒𝘴𝘺 𝘌𝘹𝘱𝘭𝘒𝘯𝘒𝘡π˜ͺ𝘰𝘯 β˜…ε½‘ Trimend in Javascript with 1 Example.

Trimend in Javascript.

If you want to trim the end whitespaces from your string then you can use trimEnd() Method present in JavaScript. The trimEnd() is a string method. By using trimEnd() in Javascript you can remove Whitespaces characters such as spaces , tabs, etc only from the End.

Β 

How to use TrimEnd() in Javascript ?

To use trimend in JavaScript you have to use stringname.trimEnd().Β Notice how trimend in Javascript is written . With E capital and all the characters of trimend in small.

  • It takes no parameters with trimEnd() in Javascript.
  • It returns a string with all whitespaces removed the end of the string.
Important: It takes 0 arguments and it returns a string.

Example:

let s ="Β  sharkTech WaveΒ  Β ";

s = s.trimEnd() ;

console.log(s) // "Β  sharkTech Wave"Β Β 

Explanation : In the above Code : The variable β€œs” contains "Β  sharkTech WaveΒ  Β "Β  . It has whitespaces at the end, after the word Wave . WhenΒ  s.trimEnd() is used , it removed the whitespaces only at the end of the stringΒ  s , not everywhere.

Read More about TrimEnd() .