Can anybody help me in formatting the below string to display the final result as “Mark, Anthony” i have been using substring in javascript to format and do we have anything like subsequence to make these format in a single line code?
var res="undefinedMark, Anthony,"
var final = res.substring(9, res.length); // removes undefined
var finalOP = final.substring(0, final.length - 9); // removes the final ,
thanks
You could use the
String.replacemethod: