Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Remove WhiteSpaces in JavaScript

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 by prionto71.medium.com #
 
PREVIOUS NEXT
Tagged: #Remove #WhiteSpaces #JavaScript
ADD COMMENT
Topic
Name
9+5 =