Having a list (array) of tags [\'tag1\', \'tag2\', \'tag3\'] I want to generate a nice title like: Content tagged tag1, tag2 and tag3.
[\'tag1\', \'tag2\', \'tag3\']
Content tagged tag1, tag2 and tag3
For the
Try like this
var g = ['tag1', 'tag2', 'tag3']; var title = g.slice(0, g.length-1).join(',').concat(' and ').concat(g[g.length-1]);