We're a place where coders share, stay up-to-date and grow their careers.
With a reduce
function distinct(list = []){ const reduced = list.reduce((acc, curr) => { acc[curr] = curr; return acc; }, {}) return Object.values(reduced) }
With a reduce