How can I turn an array, such as ["Susy", "John", "Mary"]
to "Susy, John, and Mary"
in Javascript? I can't get Ruby's to_sentence method out of my head.
Using newest JavaScript (Chrome 72+):
new Intl.ListFormat().format(["Susy", "John", "Mary"]);
which will result in:
"Susy, John, and Mary"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With