“Trim string javascript ()” Kode Jawaban

Trim JavaScript

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

Trim string javascript ()

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

trim string javascript ()

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

Jawaban yang mirip dengan “Trim string javascript ()”

Pertanyaan yang mirip dengan “Trim string javascript ()”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya