Basically I have an array, like this:
const companies = [
{
name: "Company One",
category: "Finance, Finance, Technology, Auto, Same, Same, same",
start: 1981,
end: 2004
}
]
In category, I want to write a .map or if statement to find the value matches the value if so remove all the extra values (Same for example) and just leave one instance of it.
So far what I have done is this:
const newSingles = companies.map(function(company) {
if (company.category === company.category) {
console.log("cats match remove and leave one");
//This is where I am stuck?!
};
});
It's driving me a little crazy as I was going to use .pop()
but not sure how to. What can I try next?