Question : javascript trim
Answered by : code-grepper
var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removed
Source : | Last Update : Thu, 04 Jul 19
Question : javascript trim string
Answered by : dushyant-singh-hqa76xfe5xdz
var str=" I have outer spaces ";
var trimmedStr = str.replace(/\s/g, '');
Source : | Last Update : Sun, 21 Aug 22
Question : trim() javascript
Answered by : mezen
var str=" I have outer spaces ";
var cleanStr=str.trim(); //return:"I have outer spaces" >> outer spaces removed
Source : | Last Update : Tue, 11 May 21
Question : javascript string trim()
Answered by : rasel-ahmed-9kilyai1mdfd
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!
Source : | Last Update : Thu, 23 Jun 22
Question : How to Use the trim() String Method in javascript
Answered by : godswill-ohiole-agangan
const string = " H ell o world "
const modified = string.trim()
console.log(string)
// H ell o world
console.log(modified)
// H ell o world
Source : https://www.freecodecamp.org/news/javascript-string-format-how-to-format-strings-in-js/ | Last Update : Wed, 20 Jul 22
Question : javascript trim
Answered by : dhaval-italiya
const arr = [' a ', ' b ', ' c '];
const results = arr.map(element => { return element.trim();
});
console.log(results);
//result
//['a', 'b', 'c']
//trim single string
var str=" abc c a "
str.trim()
console.log(str);
//result
//abc c a
Source : | Last Update : Sun, 23 Oct 22
Question : javascript trim
Answered by : matteo-puppis
var str = ' foo ';
str.trim(); //return string 'foo'
var str = 'foo ';
str.trim(); // return string 'foo'
Source : | Last Update : Tue, 16 Mar 21
Question : Javascript Trim
Answered by : irfan-majid
text.trim();
Source : | Last Update : Thu, 02 Jun 22