This coffeescript…
"""
#{@display_event_small(event) for event in data.top_events}
"""
outputs commas between each of the elements in data.top_events. I need to have them concatenate without commas in between. Of course, I could use a more customized loop, but I would imagine CoffeeScript has a nicer way of changing this behavior.
Let me know if I need to clarify. Thanks.
The loop expression results in an array so you could explicitly join the elements with an empty string delimiter:
There’s no special formatting options for
"#{}", CoffeeScript just turns it inside out and hands it off to JavaScript’s+. An interpolated string like"a #{b} c"becomeswhen compiled to JavaScript and JavaScript is inserting the commas when it stringifies your array.