var str = " Some text ";
str.trim();
value = value.trim();
yourvariable.trim()
const str3 = " Hellow World! "
const str3Res = str3.trim() //"Hellow World!"
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