Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

trim comma in javascript

let myString = "string,with,trailing,comma,";

// remove the last character of the string (regardless of what it is)
myString.substr(0, myString.length-1)

// remove only a comma if it appears at the end of the string
myString.replace(/,$/, "");
Comment

PREVIOUS NEXT
Code Example
Javascript :: button click redirection to another page vue 
Javascript :: js onclick open the phone application 
Javascript :: javascript copy text to clipboard 
Javascript :: check undefined object javascript one liner set to emtpy 
Javascript :: javascript foreach key value 
Javascript :: delegate click in jquery 
Javascript :: js string only positive float numbers 
Javascript :: react router how to go back 
Javascript :: javascript wait 1 second 
Javascript :: javascript replace  
Javascript :: print object in javascript 
Javascript :: calling a java function onClick with ajax 
Javascript :: redirect javascript timer 
Javascript :: bubble sort javascript 
Javascript :: expressjs create encrypted password 
Javascript :: how to clear nodemon cache 
Javascript :: Install Vue + Laravel 8 
Javascript :: jquery get base url 
Javascript :: discord.js v13 finish music play 
Javascript :: add quotes to array values javascript 
Javascript :: jquery get class name 
Javascript :: javascript format number as currency 
Javascript :: generate random boolean javascript 
Javascript :: check type string javascript 
Javascript :: m- m sequelize 
Javascript :: js get object by id from array 
Javascript :: react native textinput turnoff capitalize first letter 
Javascript :: js create array with n elements 
Javascript :: chart.js hide bar title 
Javascript :: create array number javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =