“JavaScript String Trim ()” Respostas de código

JavaScript Trim

var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removed
Grepper

JavaScript String Trim ()

let text1 = "      Hello World!      ";
let text2 = text1.trim();
naly moslih

JavaScript String Trim ()

let text = "       Hello World!        "; // output : Hello World!
let result = text.trim();
//Remove spaces with replace() using a regular expression:
let text = "       Hello World!        ";
let result = text.replace(/^\s+|\s+$/gm,''); // output : Hello World!
Tiny Coders

Respostas semelhantes a “JavaScript String Trim ()”

Perguntas semelhantes a “JavaScript String Trim ()”

Procure respostas de código populares por idioma

Procurar outros idiomas de código