String.trim

trim – Trim away space, tab, new-line, no-break space, etc from beginning and end of string.

Description

String.trim()

Return values

string primitive.

Examples

Example #1 – trim example
console.log('Hello World'.trim()); // Hello World console.log(' Hello World '.trim()); // Hello World
console.log(` Hello World `.trim()); // Hello World

External references