Trims the whitespace from the beginning and the end. This is an alias for .trim(). Useful for when you're mapping over lists.
.trim()
This is null | undefined safe. If you pass null | undefined then this will return "".
null | undefined
""
trim(null); // ""trim(" HELLO WORLD \n"); // ""[' hello ', ' world '].map(trim); // ['hello', 'world']; Copy
trim(null); // ""trim(" HELLO WORLD \n"); // ""[' hello ', ' world '].map(trim); // ['hello', 'world'];
Trims the whitespace from the beginning and the end. This is an alias for
.trim()
. Useful for when you're mapping over lists.