Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show arrays in comma separated way using last #821

Open
afattahi54 opened this issue May 23, 2023 · 0 comments
Open

show arrays in comma separated way using last #821

afattahi54 opened this issue May 23, 2023 · 0 comments

Comments

@afattahi54
Copy link

I want to print a list as a comma separated values of an array.

I found below code works in some implementation (ex: mustache

const myArray = ["apple", "banana", "orange"];
const template = "{{#myArray}}{{.}}{{^last}}, {{/last}}{{/myArray}}";
const output = Mustache.render(template, { myArray });
console.log(output); // Output: "apple, banana, orange"
````

I have test and it seems that there is no `last` tag. 

Is there alternative?  what is the best way to have this result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant