JSFiddle - React, Tailwind, and code Playground
JavaScript
var a = ['one,two,three,', 'four,five,six,'];
var lastEl = a[a.length -1];
var trimmedLast = lastEl.substring(0, lastEl.length - 1);
alert(trimmedLast);
// as a function that will return said
// please note you should write error handling and so
// on in here to handle empty or non-array inputs.
function lastArrayThing(myArray) {
var lastEl = a[a.length -1];
return lastEl.substring(0, lastEl.length - 1);
}
alert( lastArrayThing(a) );