Trimming strings

You may trim a string at both ends, or only at one, by using .trim(...), .trimStart(...), and .trimEnd(...):

"   Hello, there!  ".trim();      //    "Hello, there!"
" Hello, there! ".trimStart(); // "Hello, there! "
" Hello, there! ".trimEnd(); // " Hello, there!"
Originally, .trimStart() was .trimLeft(), and .trimEnd() was .trimRight(), but the names were changed for the same reason as .padStart() and .padEnd() were.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset