Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript remove space from two side of string

const string = " this contains   spaces ";    
string.replace(/s{2,}/g, '').trim() 
Comment

PREVIOUS NEXT
Code Example
Javascript :: lowercase or uppercase all strings in array javascript 
Javascript :: how to get all elements with same class in jquery 
Javascript :: javascript preload images 
Javascript :: update node-modules 
Javascript :: on change jquery 
Javascript :: node js list all installed modules 
Javascript :: react scroll to bottom of div 
Javascript :: javascript get all array elements except last 
Javascript :: make circle html canvas 
Javascript :: javascript disable enter key 
Javascript :: javascript css link append 
Javascript :: jquery last character in string 
Javascript :: javascript get years since a date 
Javascript :: first program in node js 
Javascript :: javascript password generator example 
Javascript :: check if array javascript 
Javascript :: material-ui hover style 
Javascript :: nodemailer gmail example 
Javascript :: how to find index of max number in js 
Javascript :: separate digits in javascript 
Javascript :: nginx rewrite proxy_pass 
Javascript :: javascript innerhtml table 
Javascript :: collision circle 
Javascript :: get iso date javascript 
Javascript :: javascript sort chars in string 
Javascript :: gitignore for angular 
Javascript :: javascript sort array of objects by number 
Javascript :: jquery on click get element 
Javascript :: javascript replace multiple spaces with single space 
Javascript :: json nuget package manager 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =