γβ ππ’π΄πΊ ππΉπ±ππ’π―π’π΅πͺπ°π― β 彑 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Β Β ";
|
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() .