How to remove duplicates from a JS array?

Hello Everyone, Can anyone tell me how will I remove duplicates from a JS array? Can anyone explain me with some example by using a filter, using, and set. I am preparing myself for the upcoming javascript interview.

let array=[β€˜a’,β€˜b’,β€˜a’,β€˜c’]
array=[…new Set(array)]

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.