I’m aware of the Looping Through Lists in the documentation but it does not cover how to handle the first and last element in the list if they need special treatment.
Problem description
Given a list like
['apple', 'banana', 'plum']
how to produce
apple, banana and plum
Previous research
Handlebars has @first and @last but they don’t work in Ember.
One important distinction about ember is that it doesn’t use handlebars – it shares an extension, so people will often call the templates the same thing, but it’s more handlebars-inspired, so using handlebarsjs.com isn’t gonna be a good time for the average learner.
This is a good question and something that doesn’t have a super satisfactory answer, but there are a few options.
For more sophisticated scenarios, or very specific use cases, you could write your own custom helper to assist you (note this is modern syntax with template imports):
For the given example, you may want to consider Intl.ListFormat as well. It could be used inside an helper. Ember Intl provides such a {{format-list}} helper.