TIL is my collection of short, technical daily learnings. 188 and counting.
Build a Sentence from a JavaScript Array
Have you ever wanted to take a JavaScript array of strings and turn them into a sentence? Here’s how you do that. const toLearn = [ 'object-oriented programming', 'frontend engineering', 'testing', ] const sentence = new Intl.ListFormat().format(toLearn) > "object-oriented programming, frontend engineering, and testing" ListFormat takes options. This has cross-browser support! The days of building a ’to sentence’ function in JavaScript are over.