I am trying to get the distinct value of array in Object. I find similar post but It cant solve me issue.
Output
In Airline there might be 1 or multiple values ( which might be repeated ) from API. How can I count the distinct value of Airline, Flight, Agent, Commodity_level_1 and Commodity_level_2
Update
Code
Array.forEach(element => {
let al = element.selectedData.airline.filter(
(v, i, a) => a.indexOf(v) === i
);
console.log(al, " in the loop");
});
Result
- "AirArabia"
- "Emirates"
- "Turkish"