I loop through an array for fetching the dynamic content. But, I couldn't remove the duplicate values while doing the foreach looping since every array element is taken into account inforEach (I can't change to for loop). Is there any solution for removing the duplicate values? I even tried creating the array after each iteration with different method. But, I was only getting the last iteration value.
forEach(( filteredItems ) => {
filteredItems.languageCodes.forEach(( languageCode ) => {
finalLanguage=languageCode;
arrayCreation(finalLanguage);
})
})
function arrayCreation(finalLanguage){
langArray=[];
langArray.push(finalLanguage);
console.log("langArray", langArray);
}
This is my filteredItems and filteredItems.languageCodes
Thanks!