Format arrays with Intl.ListFormat

March 19, 2021 1 min read
const formatList = type => new Intl.ListFormat("en-GB", { type });
const data = ["ReactJS", "VueJS", "Angular"];

formatList("conjunction").format(data); // ReactJS, VueJS and Angular

formatList("disjunction").format(data); // ReactJS, VueJS or Angular