JS: String.prototype.trim

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

Return a new string with begin/end whitespaces removed.

console.assert("\n ab \n".trim() === "ab");