I'm trying to display an array of items with Mustache, and I'd like to show them with a comma separator.
Here is my object :
{"items": [
{"display": "Item 1"},
{"display": "Item 2"},
{"display": "Item 3"},
{"display": "Item 4"}
]}
And here's my Mustache JS template :
{{#items}}{{display}}, {{/items}}
Unfortunately, this will render as :
Item 1, Item 2, Item 3, Item 4,
I'd like to remove the last ", ", since it seems odd visually.
I tried with functions, but I got the "{{items}}" text, not the array items
.
How can I do this?