JSFiddle - React, Tailwind, and code Playground

by fergmux

JavaScript

const test = [['hi'], ['hihi'], ['hi'], ['hihihi']]
const flat = Object.values(test).reduce((result, value) => !result.includes(...value) ? [...result, ...value] : result, [])
console.log(flat)

/* test.map(error => error[0]).filter((error, index, errors) => errors.indexOf(error) === index) */

const a = Array.from(new Set(test.flat()))
console.log(a)