JS: String.prototype.trim

By Xah Lee. Date: . Last updated: .
str.trim()

Return a new string with begin/end whitespaces removed. [see Whitespace Characters]

const xx = `   ab

`;

console.log(xx.trim() === "ab");
BUY ΣJS JavaScript in Depth